[Plugin: Redirection] (fixed/howto) Problem redirecting /tagname to /tag/tagname (1 post)

  1. fencepost
    Posted 6 years ago #

    Long ago, in a far distant website incarnation I had a directory named /vaio on my website that a fair number of people linked to. I've redirected it when I changed structures in the past with .htaccess, but now that I'm using WordPress I've tagged a rewrite of previous content with "vaio".
    The problem I was having is that attempts to go to http://www.fencepost.net/tag/vaio were being reconstructed to go to "http://www.fencepost.net/taghttp://www.fencepost.net/2009/05/sony-vaio-z505-z600-hard-drive-replacement/"

    The solution was to change my regex from /vaio (which was matching the tag name) to "^/vaio(.*)". The ^ leading the regex indicates that it should only match if that's the beginning of the URL; the (.*) lets it match both the old bare directory name and the old directory name plus a filename.

    For those looking for a quick reference to the regexes, it's using the regular PHP preg_replace() function and a quick reference is here: http://us2.php.net/manual/en/function.preg-replace.php#89364

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 6 years ago by fencepost
  • This topic is not a support question
  • WordPress version: 2.7.1