.htaccess文件隐藏文件后缀

效果:http://www/castle.php?do=home  => http://www/castle?do=home

代码:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ /$1.php [L,QSA]

注意:apache需要开启rewrite

posted @ 2014-03-18 09:15  zmphper  阅读(854)  评论(0)    收藏  举报