Forum Moderators: phranque
I have the foloowing test .htaccess in a test directory
RewriteEngine on
RewriteRule ^old.html$ new.html
the only line mentioning the word requitre in the httpd.conf file is
LoadModule rewrite_module modules/mod_rewrite.so
I have also changed a line to
AllowOverride All
It was set to None
accessing the file old.html with the browser does not bring up new.html
What is wrong?
The error_log shows just
the message File Does not Exist:
an identical error message is appearing in the logs for pages in other as yet uncreated directories which were on the site bevore it was moved.
It is almost as if mod-rewrite is not switched on.
I am baffled.
Also, it should give a full path to the file in that error line. Does the path look correct?
The requirements for mod_rewrite are:
Rewrite module loaded
AllowOverride directive specifying FileInfo and Options, or All
Options FollowSymLinks or SymLinksIfOwnerMatch enabled
Valid rewrite code in httpd.conf or .htaccess file
It seems you've satisfied all requirements, so I'm baffled, too.
If a directory is aliased, then control for that directory is 'diverted' before your web-root .htaccess file can have any effect. This often causes problems when people try to invoke rewrites intended to affect the cgi-bin directory, which is usually aliased for security reasons. You didn't mention cgi-bin, so this is not likely to be the problem, but I thought I should mention it.
Jim
In the error log it is old.html that does not exist
accessing new.html directly works.
the error path for old.html is the filepath of the actual file on the server which is correct.
The httpd.conf requirements you mention are what is set.
I am using
VirtualDocumentRoot
to host several domains on one ip.
I have made a chang to the .htaccess
RewriteEngine on
RewriteRule ^old\.html$ new.html
No effect
I am not ising cgi-bin the idea is to use a php program to handle things when I have all of this enabled
I have however made some progress. I have discovered how to solve the problem PARTIALLY.
My httpd.conf file is <apparently causing it not to> work.
If I comment out the line that starts VirtualDocumentRoot
and put the pages where the default DocumentRoot statement expects them to be, it works.
However I need this to work with name based virtual hosting.
[edited by: jdMorgan at 4:11 pm (utc) on April 9, 2005]
[edit reason] Removed specifics per TOS. [/edit]
<VirtualHost *:80>
ServerAdmin postmaster@example.com
DocumentRoot /path/path/example.com/
ServerName example.com
ErrorLog /path/example.com-error_log
CustomLog /path/example.com-access_log common
RewriteLog /pathd_rewrite_log
RewriteLogLevel 9
<Directory "/path/example.com">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
</Directory>
Options Indexes FollowSymLinks ExecCGI Includes
</VirtualHost>
I'm not very good at server setup, so hopefully someone else will come along who can help you with that issue. In the meantime, you might want to try experimenting with the UseCanonical name setting, as that's the only other thing I can think of that might cause trouble here.
Jim