作用
开启伪静态后在部分环境下面会出现404错误那是由于伪静态规则错误造成的,而各个环境下面的规则又不一样,现在提供几种常用规则。

伪静态规则

ISAPI_Rewrite 2.x (httpd.ini)
[ISAPI_Rewrite]
CacheClockRate 3600 RepeatLimit 32 RewriteRule (?!/public)(?!/admin)(?!/themes)(?!/plugins)(?!/data)(?!/install)(?!/upload)(?!/robots.txt)((?!/index.php).*)$ /index.php/$1
		
1. 2. 3. 4.
ISAPI_Rewrite3.x (httpd.ini)
[ISAPI_Rewrite]
CacheClockRate 3600 RepeatLimit 32 RewriteRule ^(?!/index.php)(?!/public)(?!/admin)(?!/themes)(?!/plugins)(?!/data)(?!/install)(?!/upload)(?!/robots.txt)(.*)$ /index.php/$1 [L]
		
1. 2. 3. 4.
APACHE (.htaccess)
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
		
1. 2. 3. 4. 5.
NGINX (加入location部另外NG需要开启phpinfo模式)
location / { if (!-e $request_filename)
		{
		rewrite ^/(.*)$ /index.php/$1 last;
		}
}
		
1. 2. 3. 4. 5. 6.