Rewrite rule based on query string

I'm trying to redirect to the base url (www.example.com) requests that have a particular query string (when option is com_estateagent).

I've tried the following syntax:

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^option=com_estateagent$
RewriteRule .* index.php [R=301, L]

But it gets ignored. Any suggestions?

EDIT The url that I want to change is something like this: http://www.example.com/subdirectory/index.php?option=com_estateagent...

Answers


I don't think you need the RewriteCond directive, wouldn't something like this work?

RewriteRule ^/.*option=com_estateagent /index.php[R=301,L]

This works

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} option=com_estateagent
RewriteRule .* subdirectory/index.php? [R=301, L]

Notice, the ? after index.php. That's important if you want to drop Query Parameters on redirect.


Need Your Help

Finding transformation matrix using OpenCV

graphics opencv kinect

I have 2 sets of 3D points, also feature matching between the two sets, now I need to calculate the transformation matrix between the two images.

Doxygen to parse Makefile

makefile doxygen

How do I parse a Makefile in Doxygen . My dir contains *.c and *.h files which it parses correctly. But I am not sure how I can get it to parse Makefile correctly. Is there a special plugin for GNU

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.