我的htaccess需要的是:
我整天都在努力,但我觉得它的顺序并不正确......这就是我所拥有的:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]*)(\.php)?(\?*)$ index.php/$1$3 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ /(.*)index\.php/?([^\?\ ]*)
RewriteRule ^ /%1%2 [L,R=301]
答案 0 :(得分:0)
使用.htaccess将非www重定向到www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L
删除.php扩展程序
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]