开发者

htaccess; /search/?q=test to /test

开发者 https://www.devze.com 2022-12-24 03:36 出处:网络
I have a 开发者_如何学编程similar situation to the one described in the title. All that I need to do is map all requests in the form /search/?q=test to /test.This is because we are changing the way o

I have a 开发者_如何学编程similar situation to the one described in the title.

All that I need to do is map all requests in the form /search/?q=test to /test. This is because we are changing the way our search works to make it user friendly, but still want to allow for backward compatability (i.e. anyone that may have these links bookmarked etc).

However, thus far I have this:

RedirectMatch 301 /search/?q=(.*) /$1

And that doesn't work, but:

RedirectMatch 301 /search/(.*) /$1

does...

Any idea why?

Cheers.


have you tried with RedirectMatch 301 /search/\?q=(.*) /$1 ?

I am using the \ before the ? (to force it being used as a literal character) in case it gets treated as a special char (which it is, in regular expressions..)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号