重定向所有的HTML扩展到.PHP有的、扩展到、重定向、HTML

2023-09-02 09:49:20 作者:萌妹不萌

我要更新一个网站的所有页面使用包括页脚和头。所以我要改变很多。html的网页,以.PHP。

所以我在寻找一种方法来重定向以.html相同的URL结束所有的网页,但以.php结尾。

解决方案

  RewriteEngine叙述上
重写规则^(。*)。HTML $ $ 1.PHP [L]
 

如果你想让它做一个重定向,而不​​是仅仅重写修改 [L] [L,R]

I want to update all the pages on a website to use include for the footer and header. So I have to change a lot of .html pages to .php.

PHP,将您重定向的次数过多,怎么解决

So i'm looking for a way to redirect all pages that end with .html to the same url but ending in .php.

解决方案

RewriteEngine On
RewriteRule ^(.*).html$ $1.php [L]

If you want it to be done as a redirect instead of just a rewrite modify the [L] to [L,R]