.htaccess重定向有效,但不能重写


.htaccess redirect works, but not rewrite

这是我的.htaccess文件,它之所以有效,是因为第一个重写器正确地重定向了.html->.php,但我希望也删除.php扩展名。如果有人能帮我更正这里的代码,我将不胜感激。

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)'.html$ http://vbwtest.comeze.com/$1.php [R,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}'.php -f
RewriteRule ^([^/]+)/$ $1.php

试试这个。这将重写您的所有请求。

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)'.html$ $1.php [nc]

从重写规则中删除R标志:

 RewriteRule ^(.+)'.html$ http://vbwtest.comeze.com/$1.php [NC]

[R,NC]中的R告诉它重定向,而不仅仅是重写。