Permalinks Mod_Rewrite Error

Several problems 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.

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 by the way!), 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, you can always find a solution to your WordPress questions or challenges online. 

Bash Scripting
Shell, Scripting & Bash Meaning Shell Meaning Shell is a macro processor […]
Red Hat Ansible Automation
If you need to manage your firewalls using ansible, below, you will […]
Rectenna - create power through wifi
“Rectenna” now that is a name to remember. Scientists are raising the […]