忽略目录使用modrewrite
所以我有博客在博客/忽略目录使用modrewrite
我想阻止yii(框架)重写博客/目录中的网址。
我该怎么做,使用modrewrite?
这里是我的.htaccessfile:
RewriteEngine on #RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
#RewriteCond %{HTTPS}s ^on(s)|
#RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
回答:
加入这一行:
RewriteCond %{REQUEST_URI} !blog
例如:
RewriteEngine on RewriteCond %{REQUEST_URI} !blog
#RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
#RewriteCond %{HTTPS}s ^on(s)|
#RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
这样,所有序贯规则将被应用如果请求网址与单词“博客”不匹配。
以上是 忽略目录使用modrewrite 的全部内容, 来源链接: utcz.com/qa/263020.html