1. 程式人生 > >RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 是什麽意思?

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 是什麽意思?

tle data- request apach 分享 路徑 cti 目錄 tee

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

1、排除一些條件,必須兩個條件都滿足後才重定向到index.php
//如果你訪問的文件不等於目錄

RewriteCond %{REQUEST_FILENAME} !-d

//如果你訪問不是文件,比如你可能訪問的JPEG等圖片文件

RewriteCond %{REQUEST_FILENAME} !-f

2、^(.*)$ 匹配所有的路徑映射到入口文件 index.php/$1

3、標簽 [QSA,PT,L] QSA:表示保留參數如get傳值?xxx==xx...; PT:再把這個URL交給Apache處理;L:作為最後一條;
PT和L可加可不加。

技術分享圖片

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 是什麽意思?