Okay, so there are plenty of threads on how to use mod_rewrite, but I find it seems to work a bit differently in Apache 2.4. I tried this:
<Directory /var/www/vhosts/example.com>
<IfModule mod_rewrite>
RewriteEngine On
RewriteBase /var/www/vhosts/example.com
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</IfModule>
</Directory>
This is situated in /etc/apache2/conf-available/httpd.conf/
, and I've runt sudo a2enconf httpd.conf
which worked and enabled it, but it doesn't want to work anyways..
I tried it without the Directory
bit, I tried calling it mod_rewrite.c
which wordpress suggests, but neither of the above seems to work. I also tried it with the Directory
tag but without IfModule
, which for obvious reasons ended up with Apache not starting.. And yes, I restart Apache between every attempt.
Is there a new trick to this in Apache 2.4 that I don't know if? Any help appreciated.
mod_rewrite
installed?a2enmod rewrite
.ls /etc/apache2/sites-enabled