重定向所有的HTML扩展到.PHP [英] redirect all .html extensions to .php

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

问题描述

我要更新一个网站的所有页面使用包括页脚和头。所以我要改变很多。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.

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]

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

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