Regex Htaccess删除.html的.php扩展名使URL找不到

Regex Htaccess删除.html的.php扩展名使URL找不到,regex,apache,.htaccess,mod-rewrite,Regex,Apache,.htaccess,Mod Rewrite,从URL中删除.php扩展名并替换为.html 我曾写道: Options -Indexes Options -Multiviews Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^(.*)\.php $1.html [QSA,L] 这项工作很好,我更改了分机,但我收到以下消息: Not Found The requested URL /**xxxxxx**.html was not found on t

从URL中删除.php扩展名并替换为.html 我曾写道:

Options -Indexes
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteBase / 
RewriteRule ^(.*)\.php $1.html [QSA,L]
这项工作很好,我更改了分机,但我收到以下消息:

Not Found
The requested URL /**xxxxxx**.html was not found on this server.
走错方向了吗?试一试

RewriteRule ^(.*)\.html $1.php [QSA,L]

要将
.php
文件作为
.html
提供,可以使用以下代码:

Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteBase /

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

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

还有一个问题,对此我很抱歉,我想把/xxxx.html?id=19改成/19,我怎么做,我已经写了RewriteRule^(\w+/?xxxx.php?id=$1[L,QSA],这是第二次RewriteRule^(\w+/?xxxx.html?id=$1[L,QSA],但它不起作用实际的内部URL是
/xxxx.html?id=19
/xxxx.php?id=19
?服务器中的文件名是/xxxx.php,当我输入你给我的脚本作为答案时,url变为/xxxx.htmlHmm这将是这些规则中的一个重大变化,否则对于寻找
.php->.html
模板的人来说将非常有用。我建议打开一个新的问题,这样我就可以从这个主题中单独解决它。