Regex MOD_REWRITE(RewriteCond)假定忽略domain.tld/1给定的DirectoryIndex为;1“;
这就是mod重写代码所说的Regex MOD_REWRITE(RewriteCond)假定忽略domain.tld/1给定的DirectoryIndex为;1“;,regex,apache,mod-rewrite,url-rewriting,Regex,Apache,Mod Rewrite,Url Rewriting,这就是mod重写代码所说的 if it begins with 0 to 9 then ignore if it begins with z then ignore. 在httpd.conf中 也就是说当我去 DirectoryIndex 1 domain.tld/1 这应该与 domain.tld/ 因此被上面的mod rewrite规则忽略 但它并没有忽视这一点 。。它会忽略domain.tld/1,这很好 但我不会忽视 实际上,它并没有这么说,因为$是字符串锚点的结尾。这里有一
if it begins with 0 to 9 then ignore
if it begins with z then ignore.
在httpd.conf中
也就是说当我去
DirectoryIndex 1
domain.tld/1
这应该与
domain.tld/
因此被上面的mod rewrite规则忽略
但它并没有忽视这一点
。。它会忽略domain.tld/1,这很好
但我不会忽视
实际上,它并没有这么说,因为$
是字符串锚点的结尾。这里有一些调整。这两个条件被合并为一个条件,/1
文件夹检查在规则中
if it begins with 0 to 9 then ignore
if it begins with z then ignore.
that is what this mod-rewrite code says..
这假设它存在于httpd.conf
中。如果它位于.htaccess
中,请按如下方式更改规则:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/?[z0-9] [NC]
RewriteRule ^/(?!1)(.*) /z [L,NE]
谢谢,很高兴能帮上忙。:)
if it begins with 0 to 9 then ignore
if it begins with z then ignore.
that is what this mod-rewrite code says..
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/?[z0-9] [NC]
RewriteRule ^/(?!1)(.*) /z [L,NE]
RewriteRule ^/?(?!1)(.*) z [L,NE]