if url is like this
如果网址是这样的
http://samplexxxx.com/some keywords/ it has to redirect to
http://samplexxxx.com/ap/search.php?searchterm=$1
for that i had written like this
因为我写的是这样的
RedirectMatch 301 ^/([^/]*)/ http://samplexxxx .com/ap/search.php?searchterm=$1
it was working fine
but here matching keywords should not ap i.e
但这里匹配的关键字不应该是
http://samplexxxx.com/ap/
so here redirection should done other than ap keywords then how do i need to change the regular expression matching pattern.
所以这里重定向应该不是ap关键字,那么我如何需要更改正则表达式匹配模式。
1 个解决方案
#1
2
You can use negative lookahead in your regex:
您可以在正则表达式中使用负向前瞻:
RedirectMatch 301 ^/((?!ap/)[^/]+)/ http://samplexxxx .com/ap/search.php?searchterm=$1
#1
2
You can use negative lookahead in your regex:
您可以在正则表达式中使用负向前瞻:
RedirectMatch 301 ^/((?!ap/)[^/]+)/ http://samplexxxx .com/ap/search.php?searchterm=$1