Apache Rewrite on VirtualHost = 400 Bad Request Error post

Mental note:

If you are moving the Rewrite from .htaccess to VirtualHost configuration and get a 400 Bad Request error, one or both tips below can be useful:

RewriteEngine On
# Use the %{DOCUMENT_ROOT}
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -l [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Use the absolute path
RewriteRule ^.*$ /home/www/html/index.php [NC,L]

That’s all.

Tags: apache

Comments

comments powered by Disqus