Alex
Alex

Reputation: 1515

Use modrewrite to redirect a url with querystring

I am trying to redirect an old URL that uses a query string to the new url that does not..

/tripinfo.cfm?RiverNameID=1&AdventureID=6

Now needs to go to

/trips/big-ass-river/overnight.html

So I am trying..

RewriteRule  ^tripinfo.cfm?RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]

But this is not working. .

I can redirect the main page no problem using

 RewriteRule  ^tripinfo.cfm$  /trips.html [R=301]

If any one could tell me what Im missing that would be great.

Upvotes: 1

Views: 139

Answers (1)

John Ventimiglia
John Ventimiglia

Reputation: 11

I think a ? mark needs to be escaped. Try these?

RewriteRule  ^tripinfo.cfm\?RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]

RewriteRule  RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]

Upvotes: 1

Related Questions