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

<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可加可不加。

clipboard.png

猜你喜欢

转载自www.cnblogs.com/zhouguowei/p/9240079.html