将所有 .html 扩展名重定向到 .php [英] redirect all .html extensions to .php

查看:30
本文介绍了将所有 .html 扩展名重定向到 .php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新网站上的所有页面,以将其用于页脚和页眉.所以我不得不将很多 .html 页面更改为 .php.

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.

所以我正在寻找一种方法将所有以 .html 结尾的页面重定向到相同的 url 但以 .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]

如果您希望它作为重定向而不是仅仅重写来完成,请将 [L] 修改为 [L,R]

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

这篇关于将所有 .html 扩展名重定向到 .php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆