codeigiter中我們如果打開首頁都會自動帶個index.php文件了,下面我就來介紹利用apache的htaccess規則來過濾顯示index.php的方法.
個人用的方法,感覺還不錯,代碼如下:
- <IfModule mod_rewrite.c>
- Options +FollowSymLinks
- RewriteEngine on
- RewriteBase /poster
- RewriteCond $1 !^(index.php|images|robots.txt)
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule ^(.*)$ index.php/$1 [QSA,L]
- </IfModule>
- //開源代碼Vevb.com
如果在根目錄,那么把/poster改成/就行了,如果在http://xxx.xxx/aaa 則把/poster改成/aaa.
新聞熱點
疑難解答