Htaccess redirect all .html pages to php get variables

旧城冷巷雨未停 提交于 2019-12-24 09:15:07

问题


My urls are currently like:

/events.html /contact.html

What I want to do is, redirect them to a php get variable.

E.g events.html = index.php?page=events

Any ideas on how this could be accomplished?

Thanks A lot.


回答1:


You are looking for mod_rewrite here.

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


来源:https://stackoverflow.com/questions/11670997/htaccess-redirect-all-html-pages-to-php-get-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!