Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite not working on localhost

         

kkonline

2:51 pm on Sep 15, 2007 (gmt 0)

10+ Year Member



I am using the following code in .htaccess

Order deny,allow
allow from 127.0.0.1
deny from all

# Enable mod_rewrite, start rewrite engine
RewriteEngine on
#
# Redirect "foo.html" to google.com
RewriteRule ^foo\.html$ http://www.google.com/ [R=301,L]

and have a foo.html file as "test ok"

When i write [localhost...] it just prints "test ok" AND NOT REDIRECT TO google.com . Now what to do to run the mod rewrite on localhost?

jdMorgan

3:12 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there anything in your server error log file?

I assume that you created a file called /foo.html which displays the "Test OK" message unless the request is redirected succssfully. This was not necessary, and likely affected your results if you did not completely flush your browser cache before testing.

Jim

kkonline

5:51 pm on Sep 15, 2007 (gmt 0)

10+ Year Member



Nothing on apache error log.

In apache access log i have a entry as

127.0.0.1 - - [15/Sep/2007:23:22:25 +0530] "GET /foo.html HTTP/1.1" 304 -

Even after i delete the foo.html and write localhost/foo.html i donot get redirected to google.com instead it says 404 Page NOT FOUND. What to do to run modrewrite on localhost

jdMorgan

8:54 pm on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That was a 304-Not Modified response code, showing that the "file" was served from your browser cache.

Completely flush your browser cache before testing *any* change to your configuration code.

Jim