標籤:lin highlight nginx服務 module hid tac htaccess tle view
一、Apache伺服器
<IfModule mod_rewrite.c>Options +FollowSymlinks -MultiviewsRewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
上述配置失效時,可更改為:
<IfModule mod_rewrite.c>Options +FollowSymlinks -MultiviewsRewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]</IfModule>
如果用的phpstudy,規則如下:
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] </IfModule>
二、Nginx伺服器
可以在Nginx.conf中添加:
location / { // …..省略部分代碼 if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; }}
原文連結:http://xqitw.com/path_info-hide-index.html
htaccess 一般配置