如果网址是这样的
http://samplexxxx.com/some keywords/ it has to redirect to
http://samplexxxx.com/ap/search.php?searchterm=$1
因为我写得像这样
RedirectMatch 301 ^/([^/]*)/ http://samplexxxx .com/ap/search.php?searchterm=$1
it was working fine
但这里匹配的关键字不应该是
http://samplexxxx.com/ap/
所以这里重定向应该不是ap关键字,那么我怎么需要改变正则表达式匹配模式。
答案 0 :(得分:2)
您可以在正则表达式中使用否定前瞻:
RedirectMatch 301 ^/((?!ap/)[^/]+)/ http://samplexxxx .com/ap/search.php?searchterm=$1