Page 1 of 1
URL Rewriting
Posted: Mon Oct 30, 2006 4:42 am
by rameshmrgn
hi all,
i am new to URL rewritng.
i would like to rewrite my
http://localhost into
http://www.test.com.
Is it possible? how to do that?
Thanks & Smiles,
RamE
Posted: Mon Oct 30, 2006 5:33 am
by itsmani1
try :
RewriteEngine on
RewriteRule ^
http://localhost$
http://www.test.com
not sure of it.
Posted: Mon Oct 30, 2006 5:52 am
by kettle_drum
and of course make sure your host allows mod_rewrite as this is where a lot of people have problems and its all down to the host not allowing it.
Posted: Mon Oct 30, 2006 5:57 am
by itsmani1
solution is for apache web server where rewriting is enabled.
Posted: Mon Oct 30, 2006 7:10 am
by aaronhall
I think what you're trying to do is have
http://localhost display in the browser as
http://www.test.com. If you're only looking to use a fully qualified domain name on a testing server,
http://www.somesite.com is interpreted as
http://localhost on most browsers.
Posted: Mon Oct 30, 2006 9:06 am
by theYinYeti
To my big surprise, this seems to be an OS feature, not a browser feature, at least in Linux:
Code: Select all
[root@sedentaire ~]# host www.somesite.com
www.somesite.com has address 127.0.0.1
Thanks for the tip.
Yves.
Posted: Mon Oct 30, 2006 10:38 am
by aaronhall
Interesting -- just pinged somesite.com in windows and it also points to 127.0.0.1. I'm having trouble finding anything on google about it.
Posted: Mon Oct 30, 2006 12:45 pm
by kettle_drum
I think somebody has just bought the domain and set the A record to 127.0.0.1 as its a valid registered domain name.
Posted: Mon Oct 30, 2006 2:24 pm
by nickvd
kettle_drum wrote:I think somebody has just bought the domain and set the A record to 127.0.0.1 as its a valid registered domain name.
Yup...
http://www.dnsstuff.com/tools/lookup.ch ... m&type=ALL
Posted: Mon Oct 30, 2006 3:33 pm
by aaronhall
Ha! Good man

Posted: Mon Oct 30, 2006 4:42 pm
by phpdevuk
I believe its possible under windows just to edit your hosts file to point what ever domain name you want to localhost, just remember that you won't be able to access that domain on the web once added.
article about host files
http://support.microsoft.com/kb/172218
Posted: Mon Oct 30, 2006 5:07 pm
by theYinYeti
Sure!
Same under Linux. I do that to avoid sites that add automatic adds/links on arbitrary words on the page.
Yves.
Thanks
Posted: Tue Oct 31, 2006 11:48 pm
by rameshmrgn
Thanks to all for ur kind reply