LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-02-2013, 12:28 PM   #1
Wover
LQ Newbie
 
Registered: Mar 2013
Posts: 9

Rep: Reputation: Disabled
Apache / PHP: How to listen to www.ipaddress?


Hi,


I'm setting up a new server to move a website to. I've installed apache, php, mysql, phpmyadmin etc succesfully and everything is running smoothly.

I now copied the files from the old location to the new location, but I don't want to point the DNS to the new server just yet. I'd like to first test thoroughly if everything will work.

So to test, I can only work with the ip-address, for example http://10.0.0.1/ .

Now the problem is that the company who wrote the code for the website implemented a manual check to see if the user is browsing to http://domain or http://www.domain. If the first is true, it forwards it to www.domain, which in this case would become http://www.10.0.0.1/.

My question is: Is there a way to make this work, as at the moment this does not work. I'm kind of guessing it's bad practice to have this coded in php and it should be in .htaccess file instead, but hey, this is what I'm working with, so if there is a solution I'd be very happy to hear it.

Thanks already for your help!

Regards,


Wout
 
Old 03-02-2013, 02:38 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You just need to modify /etc/hosts to point to that. e.g.
Code:
10.0.0.1 www.server.com
So when you visit the website instead of doing a DNS lookup your computer will just use the hosts file. There's a hosts file for Windows too which you can set up in a similar fashion if that's what you're using as a client. Use google for the rest.

SAM
 
1 members found this post helpful.
Old 03-02-2013, 03:08 PM   #3
Wover
LQ Newbie
 
Registered: Mar 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks, that's smarter than what I had in mind .
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache no-www to www domain rewrite after upgrade deesto Linux - Server 5 06-20-2012 12:16 PM
Apache (PHP) access files outside of www root MartenH Linux - Newbie 1 05-02-2011 01:45 PM
Apache https redirect without-www to with-www alitrix Linux - Server 3 07-24-2008 06:11 AM
listen audio sample from www.allmusic.com ... MargNat Linux - Software 3 05-27-2007 11:44 AM
PHP mail() sending as apache@ipaddress DukeLeto Linux - Software 1 04-13-2007 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration