How to change permalink in WordPress 4.6.x or later

 

WordPress by default is configured to use http://yourblog.com/?p=123 sometimes this is great if your using it for business or school website websites however it can not be said the same when doing website blogging. There’s this website from WordPress that will show how to do this the content is very informative however I think because of the latest software release’s and patches to the apache package that we use some of the code is no longer applicable. Below I will show how to change this.

Warning: Before you do this make sure you have access to your FTP site to update the files or SSH to the server incase you encounter any issues

Step 1: If you notice in your web browser there’s this http://yourblog.com/?p=123. WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links.

To change this login to your wordpress http://yourblog.com/wp-admin

Settings -> Permalinks

wordpress00

and choose the option you want for me I use the ‘Post name’  this option will change

from http://yourblog.com/?p=123 to http://yourblog.com/How-to-change-permalink

you can select which you prefer to use and change it later if its not suits you then make sure to click the ‘Save Changes’.

Note: If you encounter any error in your page ‘error page can not be displayed’ when you access your blog don’t be alarm and go to step 2:

 

Step 2: Login to your server and edit the file in your root folder .htaccess

$ cd /var/www/html/yourblog

Then list the files by issuing  below command

$ ls -la

and edit the file called .htaccess with your favorite editor nano or vim and change the file permission to 666

[[email protected]]# sudo vim .htaccess
[[email protected]]# chmod 666 .htaccess
[[email protected]]# ls -l .htaccess
-rw-rw-rw- 1 apache apache 808 Oct 24 2016 .htaccess

Below is the content you going to see

wordpress02

and take note to change the folder directory permission for your root directory

[[email protected]]# chmod 755 mytechrepublic

Step 3: Append this code in top of # BEGIN WordPress and do not put inside it if you do later when the code refresh it will delete the code we appended

<IfModule mod_rewrite.c>
 RewriteEngine On
 Options +SymLinksIfOwnerMatch
</IfModule>

wordpress03

 

then make sure you save the changes by pressing escape followed by :wq

ESC + :wq

Step 4: Edit the httpd.conf and change from ‘None’ to ‘All’

<Directory “/var/www”>
AllowOverride All
#AllowOverride None
# Allow open access:
Require all granted
</Directory>

Then refresh again the web page you should be seeing now the full path with your title ‘http://yourblog.com/How-to-change-permalink’

Be the first to comment on "How to change permalink in WordPress 4.6.x or later"

Leave a comment

Your email address will not be published.