1

I want to go from:

 www.website.com/directory/results?category=10&dir=asc

to

 www.website.com/staticfile.html

I tried the following and it doesn't seem to catch:

 RewriteRule "^directory\/results\?category=10&dir=asc" "\/staticfile\.html" [R, L]

I can get it to redirect using:

 RewriteCond %{REQUEST_URI} "^directory\/results" [NC]
 RewriteCond %{QUERY_STRING] category=10&dir=asc
 RewriteRule (.*) "\/staticfile\.html"

But then it appends the parameters after html in the last example.

Colt
  • 2,127
brenguy
  • 11

1 Answers1

3
  RewriteRule (.*) /staticfile.html?

Per the Apache RewriteRule documentation,

By default, the query string is passed through unchanged. * * * * * When you want to erase an existing query string, end the substitution string with just a question mark.

Colt
  • 2,127