Forum Moderators: phranque

Message Too Old, No Replies

Rewrite and Redirect

         

mollyhunter

3:36 pm on Dec 17, 2010 (gmt 0)

10+ Year Member



Hi All

I am using mod rewrite to make a URL seo friendly, the code looks like this:

RewriteRule ^Testing-Instruments.html$ /cgi-bin/ab_page.pl?ref=3.6


I now want to 301 redirect the old dynamic URL to the SEO friendly one but it's creating some kind of loop and isn't working, the code I tried is:

RewriteCond %{QUERY_STRING} ^ref=3.6$
RewriteRule ^cgi-bin/ab_page\.pl$ http://www.domain.co.uk/Testing-Instruments.html? [R=301,L]


I've searched forums and found a command called {THE_REQUEST} which I think may be the answer, but cannot figure out how to implement it to make it work. Please be gentle with me, very new to all this.

Does anyone have any ideas?


Molly

g1smd

8:42 pm on Dec 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, test THE_REQUEST before the redirect.

THE REQUEST contains "GET /somepath/somepage?someparam HTTP/1.1" or similar.

List the two-line redirect before the one-line rewrite.