开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜