One of the most overlooked features of WordPress is permalinks. Even so, WordPress permalinks have a significant impact on the success of your website or blog. Your visitors will have an easier time sharing your website links if you use the right permalink settings. In case you use the wrong permalinks, you will then encounter a large number of unhappy users with broken links.
WordPress URLs need to be cleaned. But Why?
When these parameters are not harmful, it doesn’t make sense to consider cleaning up the URLs for your WordPress site. Listed below are a few reasons:
#1. Technically, the URL example.com/?src=blog is not the same as example.com/?src=feed, which is different from example.com, the absolute canonical URL. Therefore, if someone bookmarks or shares these URLs on social media, it would be challenging for you to consolidate the social media metrics.
#2. Another reason is Google. Within the HTML suggestions section of your Google webmaster tools dashboard, you may notice that some pages have duplicate title tags (and thus duplicate content). Even though the underlying URLs are the same, Google may occasionally confuse them as separate pages due to the different parameters in the URL. Ideally, you should avoid such a situation.
Extra Parameters in WordPress URLs: How to Remove Them?
There is no way to prevent other services from adding new parameters to your URLs, but there is always the possibility to redirect these URLs to the ‘clean’ versions in order to ensure that your URLs are all the same.
There are two ways to do that:
1. The JavaScript Version: In your WordPress template’s header.php file, copy the following code and paste it somewhere inside the <head> tag.
2. The .htaccess Version: Open your domain’s .htaccess file and paste the following code above the mod_rewrite rules added by WordPress. You don’t need to modify any code in your HP templates.
In case you are unfamiliar with mod_rewrite, this might not seem very clear, but it is very simple to set up.
Firstly, it ignores URLs with ‘s’ or ‘p’ parameters since we do not want to remove any post identifiers, such as labnol.org/?p=19028, or search parameters, such as labnol.org/?s=pdf from the WordPress URL structure. Likewise, it ignores requests from the WordPress administration console (wp-admin).
Lastly, we execute a 301 redirect, passing all the Google Juice to the clean and canonical URL.
There is one thing you need to keep in mind. You will obviously not be able to use any functionality that relies on URL parameters if you remove them. The majority of WordPress sites should not experience any issues with this but do keep this in mind before making the change.
Warning — If this setting is changed, it will be retroactive and will affect all existing posts’ permalinks. As one of India’s best SEO service providers, we recommend installing Platinum SEO before making any changes since it will automatically redirect all your existing links. It alone makes it an excellent plugin to use. WordPress’s default behavior is to change your permalink when you change your post title. This can lead to unintended changes to your permalink.
Our WordPress developers adhere to the latest Agile development methodologies in order to produce bug-free solutions that meet the highest industry standards. Let us know what you need: we can handle everything from simple fixes to complete website redesigns.