Permalinks Mod_Rewrite Error

There are several problems which can occur while setting up your WordPress, and some can be stressful. However, there are always solutions to WordPress Permalinks not working.

Below is an example of a common problem that many users have encountered.

Example wordpress permalinks not working

The user was trying to set up WordPress for use locally and changed his permalinks to http://localhost/localwp/%postname%/ and also made sure his .htaccess file was updated successfully:

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

It didn’t work, and he thought that maybe there was an issue with mod-rewrite being disabled (Check that btw!), but that was not his issue. phpinfo() also confirmed that the mod was enabled.

But even after all these, he kept getting 404 when he tried accessing any post or link or even when using the View button on his local WordPress (e.g. http://localhost/localwp/testpage/)

Solution to mod_write

The solution is a simple addition needed on the config file. The addition is:

<Directory /srv/www/htdocs/localwp>
Options Indexes FollowSymLinks
AllowOverride All       
Require all granted

The config file is located at /etc/apache2/httpd.conf file. And in this particular case above, his wordpress files were located at /srv/www/htdocs/localwp

While it may prove difficult at times, you can always find a solution to your WordPress questions or challenges online. 


One response

Leave a Reply

Your email address will not be published.