URL Rewriting

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
rameshmrgn
Forum Newbie
Posts: 15
Joined: Sat Jun 17, 2006 1:01 am

URL Rewriting

Post 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
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

try :

RewriteEngine on
RewriteRule ^http://localhost$ http://www.test.com


not sure of it.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

itsmani1 wrote:try :

RewriteEngine on
RewriteRule ^http://localhost$ http://www.test.com

not sure of it.
solution is for apache web server where rewriting is enabled.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
User avatar
theYinYeti
Forum Newbie
Posts: 15
Joined: Thu Oct 26, 2006 3:33 pm
Location: France

Post 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.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post 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
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Ha! Good man :lol:
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post 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
User avatar
theYinYeti
Forum Newbie
Posts: 15
Joined: Thu Oct 26, 2006 3:33 pm
Location: France

Post by theYinYeti »

Sure!
Same under Linux. I do that to avoid sites that add automatic adds/links on arbitrary words on the page.

Yves.
rameshmrgn
Forum Newbie
Posts: 15
Joined: Sat Jun 17, 2006 1:01 am

Thanks

Post by rameshmrgn »

Thanks to all for ur kind reply
Post Reply