Apache Rewrite on VirtualHost = 400 Bad Request Error
English
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:
1
2
3
4
5
6
7
8
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.