[Plugin: Redirection] (fixed/howto) Problem redirecting /tagname to /tag/tagname
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
- The topic ‘[Plugin: Redirection] (fixed/howto) Problem redirecting /tagname to /tag/tagname’ is closed to new replies.