Changing permalink settings, throwing 404 error in localhost? Solution for Ubuntu with Apache

Changing the permalink settings from plane to other options like Month and name/Other can cause a 404 error while you are running your WordPress in Ubuntu with Apache localhost.  This error can be quite annoying and here are the changes you should make to get rid of this error. To change permalink navigate to settings->permalinks.



We are running your WordPress site from folder /var/www/html/testfolder/wptest


  Step 1 – Enable mode rewrite in Apache

Provides a rule-based rewriting engine to rewrite requested URLs on the fly.

Now after enabling, restart  Apache





  Step 2 – Modify the Apache Config file

Apache config file is  etc/apache2/apache2.conf. Open the file using the following command.

Find the following lines in the config file

replace this with the following. The AllowOverride ride is changed to All and require is changed to all granted.

AllowOverride directive is used to allow the use of a. htaccess within the webserver to allow overriding of the Apache config on a per-directory basis.

Require provides a variety of different ways to allow or deny access to a resource.





  Step 3 – Restart Apache






Step 4 – Change permalink  –  Create/modify .htaccess file

While changing the permalink settings WordPress provides a .htaccesss file. Place the .htaccess file in your WordPress root folder.

Please note that RewriteBase and RewriteRule have the path to your files. Now modify your permalinks, it should work fine

No Comments

Leave a Reply

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