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

相關文章
相關標籤/搜索