I'm having trouble getting mod_rewrite
to behave properly on WAMP after upgrading to PHP 7.0.0. All RewriteRule
s seem to be completely ignored by Apache. They result in 404
errors.
This is my virtual host in httpd-vhosts.conf
:
<VirtualHost *:80>
ServerName myproject.local
DocumentRoot "D:/Projects/myproject/www"
ErrorLog "D:/Projects/myproject/www/apache_errors.log"
LogLevel info
<Directory "D:/Projects/myproject/www/">
LogLevel debug
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
This is my .htaccess
, which is recognized by Apache, will handle directives like DirectoryIndex
, but seems to ignore any RewriteRule
s:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z_\-\s]+)/?$ $1.php [L,QSA] #root pages
RewriteRule ^([a-zA-Z_\-\s]+)/([a-zA-Z_\-\s]+)/?$ core/modules/$1/$2.php [L,QSA] #pages with no id
RewriteRule ^([a-zA-Z_\-\s]+)/([a-zA-Z_\-\s]+)/([0-9]+)/?$ core/modules/$1/$2.php?$1_id=$3 [L,QSA] #pages with id (edit, etc)
My apache error log shows nothing of consequence: just that request fails:
[Sun Dec 18 15:47:03.787934 2016] [core:info] [pid 12532:tid 1140] [client ::1:57506] AH00128: File does not exist: D:/Projects/StoryTracker-Core/www/test
There must be some outside force I'm not aware of causing these results.
EDIT I've updated my virtual host as follows to no avail:
<VirtualHost *:80>
ServerName myproject.local
DocumentRoot "d:/projects/myproject/www"
ErrorLog "d:/projects/myproject/www/apache_errors.log"
LogLevel trace8
<Directory "d:/projects/myproject/www/">
Options +Indexes +FollowSymLinks +Includes
AllowOverride All
Require all granted
LogLevel trace8
</Directory>
</VirtualHost>
mod_rewrite
did not like dashes in my project directory name.After renaming directories in my project path away from using
-
, I was able to figure out the rest of the issues fromLogLevel debug rewrite:trace8
.