.htaccess中重定向所有的.html页面到PHP得到变量 [英] Htaccess redirect all .html pages to php get variables
本文介绍了.htaccess中重定向所有的.html页面到PHP得到变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网址,目前这样的:
My urls are currently like:
/events.html /contact.html
/events.html /contact.html
我想要做的是,他们重定向到一个PHP得到变量。
What I want to do is, redirect them to a php get variable.
例如events.html =的index.php?网页=事件
E.g events.html = index.php?page=events
在如何可以实现任何想法?
Any ideas on how this could be accomplished?
多谢了。
推荐答案
您正在寻找的 的mod_rewrite
这里。
You are looking for mod_rewrite
here.
通过沿线的规则的东西(假设mod_rewrite的已安装并启用,你把它放在.htaccess文件)
With the rule something along the lines of (assuming mod_rewrite is installed and enabled and you're putting it in a .htaccess file)
RewriteEngine on
RewriteRule ^/(.*).html /index.php?page=$1
这篇关于.htaccess中重定向所有的.html页面到PHP得到变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文