Aim

In this post we will try to focus one of the important bugs that people get when they try to change the permalink settings of the post in WordPress.

Step 1 : Create a .htaccess

  • Create a .htaccess file in the root directory of your WordPress webiste
touch .htaccess
  • Then put the following contents in the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# 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>

Step 2 : Change Permission for .htaccess file

chmod 666 .htaccess

Step 3 : Enable the mod_rewrite feature of the Apache server

sudo a2enmod rewrite

Step 4 : Update the apache2 config file

  • Open the apache2 config file
vim /etc/apache2/apache2.conf
  • Search for the below config and update the AllowOverride to ALL
<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Step 5 : Restart Apache server

sudo systemctl restart apache2

Step 6 : Update the Permalink Settings

  • Goto Permalink settings

Goto Permalink settings

  • Change the permalink setting to something different from the existing one

Select the plain option in Permalink

  • Reload you website

  • Again change the permalink setting to the postname one

Select the postname option in permalink

  • Reload your website and check if everything is working fine

Step 7 : Update the .htaccess with 644 permission

chmod 644 .htaccess

Happy Coding

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x