I've recently converted a site from Joomla to WordPress. I'm down to polishing up the old Joomla site links that don't match the WordPress structure, and I've run into a problem where I need some help: tags. The Joomla site had close to 500 tags, and all the tags were indexed in Google and other search engines. The Joomla tags links have a structure like




while the WP site tag links look like


What I really would like to do is have a 301 redirect that points all the old Joomla tags to their equivalents on the new WP site instead of doing several hundred htaccess entries, one for each tag

("Redirect 301 http://example.com/components/tag/apples.html http://example.com/tag/apples/" works).

The tags themselves are the same on both sites, so it's not a matter of renaming tags or getting tags with different names to match up.

But I can't figure out how to make the redirect work. I've tried doing things like

"Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/"


"Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/*/"





for the redirect target. None of those work.

Quite frankly I don't know my way around regex very well, so my trying to find a solution would be mostly an Easter egg hunt where there may or may not even be any Easter eggs. So I'm hoping someone on the WP forum will be able to help me out or point me to a solution.

Thanks for any help,


1 Answer 1


This is more an Apache/htaccess question and better suited on Stackoverflow but for the sake of answering try this:

RewriteEngine On
RewriteBase /
RewriteRule ^(components/tag|tags)/(.+?)\.html$ http://example.com/tag/$2/ [R=301,L]

Place it before the WordPress rules in your .htaccess (or Apache conf if you have access).

  • Thanks for your reply. I really appreciate your taking the time to answer my question. But-- when I add your rewrite suggestion to the htaccess what I wind up with is that "www.example.com/components/tag/apples.html" gets redirected to "www.example.com/tag/components/tag/" and WP returns a 404 on the word "tag". The apples get left out of the basket. Commented May 7, 2014 at 19:50
  • Woops, my bad - change $1 to $2 (or see revised answer) Commented May 8, 2014 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.