Search code examples
apache.htaccesshttp-redirectjoomlahttp-status-code-301

Redirect 301 from a known dynamic url to known static url


A little background - this site is running Joomla and already has SEF urls. Unfortunately, someone else on another site has linked to our site (extensively) using the non-sef url. Joomla will allow both versions of the URL to access the correct page.

I would prefer to do a simple

redirect 301 index.php?option=com_content&view=article&id=50&Itemid=18 http://www.mywebsite.com/anythingiwant.html

But this is not so simple, I suspected some of the characters in the first url would need to be escaped but that did not work either. I also put quotations around the first URL with escaped characters and no matter what I do, I cannot redirect that one very specific and dynamic URL to any other page.


Solution

  • To fix my SEO issue with this, I installed an SEO module for Joomla that allows me to assign a 'canonical url' meta tag to each article. I put the SEF url in for this meta tag, and Google has re-indexed it accordingly.