mod_rewrite stopped working

New to mod_rewrite? This is a good place to start.

mod_rewrite stopped working

Postby Royan » Mon Feb 23, 2009 8:33 am

Hello, I don't know what has happened after i made changes described below but my mod_rewrite module has simply stopped working and I don't know where else to look to fix it, so i need your help


Details
My http.conf has not changed since mod_rewrite (here is mod_rewrite part)
Options +FollowSymLinks
RewriteEngine on
RewriteLog "E:/www/logs/rewrite.txt"
RewriteLogLevel 9

Below are things i've changed when it stopped working:
I added VirtualHost directives into http.conf e.g.:
<VirtualHost foo.localhost:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot E:/www/root/Foo/foo.com
ServerName foo.localhost
ErrorLog E:/www/logs/foo_error_log.log
CustomLog E:/www/logs/foo_access_log.log common
</VirtualHost>


and therefore I had to change hosts file for ever subdomain of localhost, e.g.
127.0.0.1 localhost
127.0.0.2 foo.localhost
127.0.0.3 other_foo.localhost
...


The code in .htaccess has not changed since mod_rewrite was working, but right now even some basic rules like RewriteRule ^login(/(.*))?$ /login.htm [L] are not working (not redirecting)

In Apache access log I can see the following
127.0.0.2 - - [22/Feb/2009:22:53:22 +0300] "GET /login HTTP/1.1" 404 303


In Apache error log I can see the following:
[Sun Feb 22 22:53:22 2009] [error] [client 127.0.0.2] File does not exist: E:/www/root/Foo/login, referer: http://foo.localhost/


Well, and finally in mod_rewrite log ... i can see nothing! It's just empty!

Do not know where to look next, need you advice?
Royan
 
Posts: 6
Joined: Wed Sep 05, 2007 3:48 am

Postby richardk » Tue Feb 24, 2009 2:29 am

The code in .htaccess has not changed since mod_rewrite was working, but right now even some basic rules like RewriteRule ^login(/(.*))?$ /login.htm [L] are not working (not redirecting)

Does this mod_rewrite test work?
Does anything work in a .htacess file (like a custom ErrorDocument)?
Code: Select all
ErrorDocument 404 /your_file


I suspect you need to enable .htaccess file processing by adding
Code: Select all
<Directory "E:/www/root/Foo/foo.com">
  AllowOverride All
  Options +FollowSymLinks
</Directory>


Well, and finally in mod_rewrite log ... i can see nothing! It's just empty!

Mod_rewrite in the main server configuration is not by defualt Inherited by <VirtualHost>s. You might need to add
Code: Select all
RewriteOptions Inherit

to the <VirtualHost>s.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Re: mod_rewrite stopped working

Postby Royan » Sat Dec 04, 2010 7:16 pm

Thank you Richard, your answer has been really helpful!
Royan
 
Posts: 6
Joined: Wed Sep 05, 2007 3:48 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron