Permalink Validator

Validates the URL used and if not matching the official permalink then it issues a HTTP 301 or HTTP 404 message.

Author:Rolf Kristensen (profile at wordpress.org)
WordPress version required:2.0.0
WordPress version tested:2.6
Plugin version:0.7
Added to WordPress repository:16-06-2007
Last updated:17-08-2009
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://wordpress.org/extend/plugins/permalink...
Total downloads:9 865
Active installs:20+
plugin download
Click to start download

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.

Version History

Version 0.8

  • Fixed PHP Warning: strpos() [function.strpos]: Empty delimiter
  • Converted the PHP file from UTF8 to ANSI (Removed special BOM character in file beginning)

Version 0.7

  • Permalink Validator will not perform redirect of POST server request

Version 0.6

  • Fixed a redirection bug introduced in 0.5 when the front page is a page of posts

Version 0.5

  • WordPress 2.3 includes permalink validation (canonical urls) when using Apache, so this plugin should now only be used with IIS
  • Added support for HTTPS urls
  • Added support for special IIS installations where PATH_INFO and SCRIPT_NAME is the same
  • Added small hack to exclude pages from validation (One is required to edit the source to use it)
  • Added detection of the plugin Jerome’s Keywords

Version 0.4

  • Better guessing of a proper REQUEST_URI
  • Finds the proper REQUEST_URI when using isapi_rewrite
  • Finds the proper REQUEST_URI when using IIS Mod-Rewrite
  • Improved validation as it nows expects a proper REQUEST_URI (Guess Apache is now supported)

Version 0.3

  • Fixes trailing slash for pages and categories in WP 2.2 when using a post permalink structure without ending slash.

Version 0.2

  • Added support for static front page.
  • Added detection of integrated BBPress.
  • Checks that WordPress has been started before adding hooks

Version 0.1

  • Fixes REQUEST_URI for WP on IIS, which also fixes pagination.
  • Handles permalink structure with or without index.php.
  • Handles default permalink structure using only post-id.

Testing Procedures

For each of the different permalink structures:

  • Default permalink structure (Using query string)
  • Permalink structure with index.php
  • Permalink structure without index.php (Using ISAPI_rewrite)
  • Permalink structure ending with .html
  • All the above in a sub-directory

Tries the following pages:

  • Front page and paged
  • Static page
  • Post page
  • Category page and paged
  • Front page as static page (WP 2.2+)
  • Front page as post page (WP 2.2+)

Contributors

  • Scott Yang for giving me the idea and the example of to how make this plugin.
  • Gabe Anderson for giving me the initiative to release this plugin.

FAQ