重写规则不适用于快速cgi服务器,PHP

This is my rule written in .htaccess on Apache 2.0 server:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]   
RewriteRule ^ %1 [R,L]

The rule is to remove the .html from the url. It works fine on my local apache server, but not the fast cgi.

Any suggestions for the rule to work.

Try this code in your DOCUMENT_ROOT/.htaccess file to hide html extension:

RewriteEngine On
RewriteBase /

## hide .html extension
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+?)/?$ /$1.html [L]