Redirect URLs using partial query string

On our website using Joomla we have duplicate URLs for the same page being found by Google Webmaster Tools. For instance the following URLs go to the same page on our site:

  1. /lawson-equipment/auxiliary-equipment/poly-pro-sinks?option=com_content&view=article&id=75&Itemid=74
  2. /lawson-equipment/pre-press/poly-pro-sinks/index.php?option=com_content&view=article&id=75&Itemid=74
  3. /technical-support/digital-learning?option=com_content&view=article&id=75&Itemid=74
  4. /lawson-equipment/textile-equipment/dryers/encore-dryer

with the fourth URL being the actual path I want. How would I go about formulating a rewrite rule that would grab any URL query strings with "&id=75" to be directed to the SEF URL without doing a Redirect 301 for each of the incorect URLs? This happens often.


Success! Using a RewriteCond command with a common snippet from the non-SEF addresses, and a RewriteRule command for the target address using regular expressions I come up with the following for my .htaccess file:

RewriteCond %{QUERY_STRING} ^.*com_content&view=article&id=75&Itemid=74$
RewriteRule ^index\.php$ http\:\/\/www\.mysite\.com\/lawson\-equipment\/textile\-equipment\/dryers\/encore\-dryer? [R=301,L]

So far this seems to be working and hasn't affected anything else that I can see. Please feel free to comment or add another answer if there is a better way of doing this!

Need Your Help

TTreeview limit the node editing text length


I am using TTreeView in C++ Builder XE7. I am allowing users to edit the node text on certain nodes, but I need to limit the amount of characters they can type in to 10.

Use groupdict to parse string to dict

python regex

I need to process the text to create a dictionary {name: quantity}

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.