Home  >  Article  >  Backend Development  >  .htaccess里面正则有关问题

.htaccess里面正则有关问题

WBOY
WBOYOriginal
2016-06-13 13:05:35865browse

.htaccess里面正则问题,在线等
RewriteRule ^([A-Za-z]+$)/|([1-9]\d*).html test/cata/index.php?id=$2
RewriteRule ^([A-Za-z]+)/($) test/cata/index.php?entrance=$1

请问如何在正则[A-Za-z]+$里面排除某个单词如"book"、"class"
相当于当我访问http://localhost/test/abcdefg/13.html可以
但是当我访问http://localhost/test/book/13.html时不可以

------解决方案--------------------
不知道可不可以使用正则表达式用的“向后引用”+“零宽断言”,我想应该可以实现
------解决方案--------------------
再来一条语句
------解决方案--------------------
rewrite支持负向零宽断言
(?!exp)
(?一个是先行,一个是后发
------解决方案--------------------
把合法的单词列出来,如下:
(arr|unset|function)\.html
这样就只匹配arr.html;unset.html;function.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn