apache重写URL时,排除静态资源

THINKPHP项目部署的apache 上面时,若是为了隐藏入口文件配置了重写URL,会致使将静态资源的URL也解析成Controller/Method,致使触发模块不存在php

因此在URL重写配置中,须要排除静态文件目录,例如:(static|upload),...html

在项目根目录下的.htaccess配置以下:apache

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine Oniview

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-fcode

RewriteBase /tp
RewriteCond $1 !^(plugs|uploads|static)
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>xml

相关文章
相关标签/搜索