htaccess redirect with parameters not working

I'm struggling with an Apache rewriterule. I need to do the following:

Redirect permanently:


I've got the code below, it works without the url parameters but I can't seem to get it to work with parameters. Am i missing something?

RewriteCond %{QUERY_STRING} ^prevent_cache=([0-9]*)$
RewriteRule ^/folder/viewer/data/settings.xml$ [R=301,L] 




The only error I can see, is the leading slash / in the RewriteRule pattern. This should be

RewriteCond %{QUERY_STRING} ^prevent_cache=[0-9]*$
RewriteRule ^folder/viewer/data/settings.xml$ /siteid/includes/themes/siteid/swfs/viewer/data/settings.xml [R,L]

You don't need to append the query string to the substitution URL, because this is done autmoatically.

When everything works as you expect, you can change R to R=301. Never test with 301 enabled, see this answer Tips for debugging .htaccess rewrite rules for details.

Need Your Help

How To Add Event Listener To OverlayView?

javascript google-maps google-maps-api-3 overlay-view

I am trying to create an OverlayView on google map as a custom marker.

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.