WordPress post moving not found error

WordPress post moving not found error occurring after updating your wordpress permalinks with the %postname%. The error will not occur if I update the permalinks to %default%. It may be due to your mod_rewrite module of your webhosting server. Even if you enable the mod_rewrite module in server sometimes it will not get reflect in htaccess condition. No worries we can override the condition from server default config file. Am just writing the fix for ubuntu apache server. If you are using any other server, please check the configuration file of that corresponding server.

Make sure you have the following code in htaccess file

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

Activate the mod_rewrite module in your server by following commands

sudo a2enmod rewrite
sudo service apache2 restart

Update the configuration file with having the project folder as a document root.

sudo nano /etc/apache2/sites-available/000-default.conf

add the following lines in the file

<Directory "/var/www/html/{projectfolder}">
    AllowOverride All
</Directory>

Restart your server again

sudo service apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *