When using WordPress for your website it will default to the standard URL format showing the page number. However, many of us have changed or initially set up our WordPress blogs using the dates in the URL’s such as imageinnovationsllc.com/2013/1/my-blog-post. Initially you might think that the date in the URL may be helpful for visitors to your website to help them know when an article was initially written. It may be helpful, but has been shown to actually hurt your website. Visitors might not have confidence in an older article, even if it is a great article and valid the day they visit it. Most importantly though, it clutters up your URL and ultimately will hinder your search engine rankings.
WordPress permalink setting allows bloggers to customize the structure of a URL. Doing so correctly will help your WordPress website to be search engine optimized, improve the aesthetics, usability, and forward-compatibility of navigation and links. Within WordPress’s Permalinks setting, WordPress presents a few common permalinks structure, of which at least two are date-based.
The data-based permalinks have the following URL structure:
The date in URL unnecessary adds to the length of URL, can dissuade visitors, and hurt SEO. The best SEO practice is to strike off and remove the /yyyy/mm/dd or /yyyy/mm from the URL structure of the WordPress permalinks.
Here’s a quick tutorial on how to change the permalinks structure of your WordPress websites URLs with proper redirect in the .htaccess file. This will help your WordPress website to avoid 404 page not found errors and minimize the loss of traffic due to incoming out of date URL’s any links to your website. This will help your navigation, make your site more user friendly, improve your SERPs, and Google’s PageRank.
The URL’s of your WordPress premalinks will end up in this format: https://www.imageinnovationsllc.com/sample-post/ This should be the format that most WordPress websites or any other website should strive for. It is clear and concise and will help users and search engines better understand and use your website.
- First change the permalinks configuration in your Worpress. Go to the WordPress Dashboard of your website and navigate to Settings -> Permalinks.
- Select Post name in WordPress Permalink Settings..
- Select Save Changes in WordPress Permalink Settings.
- FTP or SSH into the web server which hosts the WordPress installation, and go to the directory where the .htaccess file is located for the site. This should be in the WordPress website root directory.
- Create a copy of the .htaccess file. Sample: .htaccess_backup
- Edit the .htaccess file directly. OR Download the .htaccess file and edit it locally. Then upload it when you are done.
- Edit the .htaccess with editor such as notepad, Wordpad, or any other text file editor.
- Add one of the two code blocks below depending on your old URL structure above the WordPress code in your .htaccess file.
For existing permalinks with /%year%/%monthnum%/%day%/%postname%/:
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ /$4 [R=301,NC,L]
For existing permalinks with /%year%/%monthnum%/%postname%/:
RewriteRule ^([0-9]+)/([0-9]+)/(.*)$ /$3 [R=301,NC,L]
- Save the WordPress .htaccess file.
- Immediately test your WordPress website. Any error in the code can easily shut down your site with server errors. Access your WordPress website to be sure it is still functional. If it is not. Replace the edited .htaccess file with your backup or change the file back to how it was. Then try to enter the code again.
- With your WordPress website working enter a few links with the old URL structure to test that the redirection is working properly.
You may want to utilize MySQL replace function to replace the links with old permalink structure in posts, pages and comments to new URLs directly in database, much like what is been done when moving WordPress to new domain or location. Useful when you have thousands of articles which make manual changing impossible.
You can easily track problem URL’s with Google Webmaster Tools. This is an invaluable to keep track of the health of your site and to discover and correct issues that may be hurting your SEO and Google rankings.