Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I have a website, like http://website.com.

I also have a "back-up" (development version) of this website on my computer (localhost), including the database and everything.

The problem with this back-up is that I have to change all the script config for it to work, like domain name (to localhost/website), paths, database name, pw etc...

How can I access my localhost website from my real domain name? Ie - when I type http://website.com in the browser address bar, I want to see my local website backup, just like if I typed localhost/website. I want to the scripts to think that they are running under that domain name.

Obviously I only need this temporarily, because I still want to be able to access my live site :)

I'm using Apache 2.2 and PHP 5.3, running trough WAMP 2.0 (windows 7)

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

On windows, c:/windows/system32/drivers/etc/hosts (Open hosts in notepad) and edit the line starting with 127.0.0.1 ...

127.0.0.1 localhost www.website.com website.com

and what this does, is makes it so ONLY FOR THAT COMPUTER all requests to website.com will use localhost instead. Hope it helps.

share|improve this answer
    
Thanks for the edit. Wasn't sure that method worked. –  U4iK_HaZe Sep 6 '11 at 23:01
    
seems to work, kind of, but I get the root directory (localhost). How can I get the localhost/website directory? I tried changing localhost/website in that file but that didn't work :( –  Alex Sep 6 '11 at 23:11
    
@U4iK your original method actually will break things, since it overrides previous entries (like localhost) –  Zypher Sep 6 '11 at 23:22
    
@Alex that only controls your dns resolution, you'll have to modify your your web server configs to server localhost/website as the root –  Zypher Sep 6 '11 at 23:22
    
it works ! I followed the instructions from here: kintek.com.au/web-design-blog/… :D –  Alex Sep 6 '11 at 23:38
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.