Forum Moderators: phranque

Message Too Old, No Replies

localhost redirects to live domain

         

malcolmcroucher

1:54 pm on Aug 2, 2008 (gmt 0)

10+ Year Member



i have a webserver installed on my pc which works at 127.0.0.1

now whenever i try load a page

eg [127.0.0.1...]

it redirects me to my website which is live at

www.domain.com

anyone know how to fix this as i cant seem to ?

Regards

Malcolm

Marshall

4:33 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am sure someone will correct if I am wrong, but when accessing a server installed on your pc, should the url not be [/url]http://localhost/web/index.php? That is how it works on mine.

Marshall

maximillianos

5:20 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can also add an entry to your "hosts" file to redirect that IP to "localhost".

trillianjedi

5:31 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It could be that you have a redirect script in your .htaccess file (commonly used to redirect http:// to [www...] and vice-versa).

localhost

... is usually just a DNS rule pointing to 127.0.0.1, so commonly interchangeable.

You can also add an entry to your "hosts" file to redirect that IP to "localhost".

That's a better way of doing it, assuming your using this as a test box before pushing changes live.

[edited by: trillianjedi at 5:32 pm (utc) on Aug. 2, 2008]

londrum

5:32 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



try visiting
[127.0.0.1...]
and see if it still redirects.
maybe it's a rule in your .htaccess file or something like that, which is redirecting /web/index.php to yourdomain/web/

[posted at the same time as above... snap!]

malcolmcroucher

5:35 pm on Aug 2, 2008 (gmt 0)

10+ Year Member



[localhost...] and [127.0.0.1...]

I think the problem is that i have a google website optimizer script in the code thats why its redirecting.

Regards

Malcolm

trillianjedi

5:50 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



script in the code thats why its redirecting

A rule in your /etc/hosts file will fix that.

g1smd

11:55 pm on Aug 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One point, don't use the index file filename in any of your links.

End the URL with the trailing slash, omitting the index filename.

topr8

12:53 am on Aug 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>>I am sure someone will correct if I am wrong, but when accessing a server installed on your pc, should the url not be [localhost...] That is how it works on mine.

you normally (eg by default on a windows box) can use:
[localhost...]
[127.0.0.1...]
[machinename...] (eg the name of the computer)

plus the LAN network address

of course you can also fiddle with your hosts file and thus be able to type whatever you want!