-1

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)

Alex
  • 55
  • 8

1 Answers1

4

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.

Zypher
  • 36,995
  • 5
  • 52
  • 95
U4iK_HaZe
  • 631
  • 5
  • 13
  • 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 06 '11 at 23:11
  • @U4iK your original method actually will break things, since it overrides previous entries (like localhost) – Zypher Sep 06 '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 06 '11 at 23:22
  • it works ! I followed the instructions from here: http://www.kintek.com.au/web-design-blog/configuring-multiple-domains-within-wamp-for-local-development/ :D – Alex Sep 06 '11 at 23:38
  • Glad to hear. Keep us posted on how your server's coming along, as (I'm sure) you will be adding and modifing its code. Hopefully it's as fun as I find it. – U4iK_HaZe Sep 06 '11 at 23:39
  • lol I'm scared I'll forget to follow these steps and I make changes to the live site :) – Alex Sep 06 '11 at 23:39
  • Well for me, I own a .info domain too, which runs on its own virtual host. The virtual host runs a htdocs2 folder, so as long as I only edit htdocs2 stuff, I'm good. And plus, this way, you get a live site on the net as beta testing. Even add a .htaccess login if you want it protected. – U4iK_HaZe Sep 06 '11 at 23:41