1

我在我的 .htaccess 中使用以下 RewriteRule:

RewriteRule ^(.*)\.html$ /index.php?show=$1 [QSA,L]

现在我已经注册了谷歌网站管理员工具,它尝试通过请求一个名为google(someSerialNumber).html. 但是由于我的 RewriteRule 它被重新定向并且验证失败,所以我必须在手动验证时临时删除规则,这让我很恼火。

正确的正则表达式将如何重写除验证文档之外的所有内容?

4

1 回答 1

2

You could try using a negative lookahead:

^(?!google\([^\)]+\)\.html$)(.*)\.html$

If there's only one serial number, just put it in the regex instead of [^\)]+.

The regex won't match google(someSerialNumber).html because of the negative lookahead.

于 2013-08-18T11:53:46.513 回答