Plugin Directory

Permalink Validator

Author: Rolf Kristensen

Wordpress 2.3 now includes validation of the permalink URL when using Apache web server, but if using IIS then this plugin is still relevant.

Permalink Validator helps Search Engine Optimization (SEO) as it prevents duplicate contents on your Wordpress blog:

  • Adds trailing back-slash if missing (Can also be done with htaccess or isapi_rewrite).
  • Adds or removes www prefix according to your permalink structure (Can also be done with htaccess or isapi_rewrite).
  • Forces a correct 404 page instead of showing an empty search result when using an invalid URL
  • Works only on post, pages and categories. Archives based on date (Daily, Monthly, Yearly) and search-result-pages should use noindex. Feed and trackback pages should be added to the robots.txt.
  • Fixes pagination for WP on IIS.
  • Fixes trailing slash for pages and categories on WP 2.2 when not having trailing slash in post permalink structure.

Wordpress it very forgiving when supplying an URL that doesn't match the actual permalink to a post or a page. This is caused by Wordpress using some very greedy wp_rewrite_rules, which accepts almost any URL as valid.

This means that multiple URLs could be used to reach the page, which search engines sees a duplicate content and leads to penalty.

For example it will accept the following permalink URL as valid:

http://example.com/post/hello-world/2

Even though the official URL is this:

http://example.com/post/hello-world/

Permalink Validator makes a hook to template_redirect, and then adds some extra validation of the URL supplied before actually calling the theme-templates.