Showing posts from March, 2016

Apache - RewriteRule in htaccess vs httpd.conf

Typically Apache’s RewriteRule sets from mod_rewrite go in  .htaccess  files, but sometimes you have a good reason to put them in your general server config instead: your  httpd.conf  or apache2.conf  file (or a file you  Include  from one of those). If you’ve done this before, you’ve probably been surprised that it didn’t work quite the same. So while this works in .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /index.php [L] Putting the same thing in your VirtualHost doesn’t work at all: <VirtualHost *:80>     ServerName example .com     DocumentRoot /var/www/ example /     <Directory /var/www/example/>         Allow From All     </Directory>     RewriteEngine On     RewriteCond %{REQUEST_FILENAME} !-f     RewriteRule . /index.php [L] </VirtualHost> Apache doesn’t tell you  why  it doesn’t work. It just doesn’t work. You most likely will get an Error 500 status with a message