Permalinks not working (.htaccess is writable)

I've just recently setup a new Wordpress site on a Debian based VPS. I've managed to get everything working fine except for the permalinks. None of the options work except for the default one.

My .htaccess file currently looks like this -

# BEGIN WordPress
IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
/IfModule

# END WordPress

Any idea how to fix this?

Thanks!

Topic vps permalinks admin Wordpress

Category Web


As @milo said in the comment, the most usual cause of such a behaviour is not have mod_rewrite active. How to activate it might vary between OS (or apach distributions on windows and macOS) so best to consult the documentation relating to activating apach modules on your specific OS.


I know this is not the greatest answer by i had a similar issue only the other day and I recommend is to download Wordpress again and upload the .htaccess file and save permalinks also make sure your uploading in binary mode


Have you tried something simple to ensure it is actually rewriting? Something like...

RewriteEngine On
RewriteRule ^.*$ verified.php

Then create a verified.php page...

<?php
print 'mod_rewrite works!';
?>

Now you should hit that page no matter where you try to go on the site. If you don't mod_rewrite isn't working.

You can also turn on mod_rewrite logging. You cannot do it in .htaccess but you can in the VirtualHost directive or directly in your server's conf file.

RewriteEngine On
RewriteLog "/var/log/httpd/rewrite.log"
# From 0 (no logging) to 9 (OMFG make it stop)
RewriteLogLevel 3

Once it is on you can see what is, or isn't happening.

Oh and don't forget to turn it off. It can have a serious impact on the server if it is set 3+.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.