Override existing path with Path Redirect

When rearranging content sections that result in changed URLs, it is very important to remember that users may have bookmarked individual pages and the Google index will be pointing searches to a now defunct address.

Several solutions exist, including mod-rewrite instructions in the .htaccess file. This is particularly handy for complex changes or a large number of addresses that need to be changed with a specific pattern.

Drupal's Path Redirect provides an integrated solution with several useful options and tools. For example, the ability to view the last time a redirect was used is an excellent tool that will assist in discovering links in need of an update. Another useful setting is the choice of Redirect status - for permanently moved content, 301 should be used as this instructs search crawlers to update their respective database with the new address.

Adding a new entry into Path Redirect, it checks that the path to be overridden is not an actual valid URL. Recently, I struggled with this error message:

The source path blog/test is a currently valid path. You cannot override existing paths. You can however, create URL aliases for them.

I knew for sure that the blog/test path was not valid. It was the Views module setup for blog postings and blocks, that was marking anything after blog/ as a valid URL - with no content. Read about the Views fix that came later.

My solution involved changing the path within the offending view display to something other than blog (i.e. test). Returning to the Path Redirect section now, adding a new redirect was no longer a problem. Remember that with the Pathauto module installed, the URL alisases can be recreated in bulk. Don't forget to change the path in the views display back to the original setting.

Share this post