本文介绍了如何使的.htaccess重定向各个环节为.html后缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://advokat-malov.ru/index.php
http://advokat-malov.ru/ 
http://advokat-malov.ru/index.html

如何让htaccess的重定向的.php,或SEO链接(不带扩展名)为.html

how to make htaccess redirect .php, or seo links(without extension) to .html

如何使用的RewriteCond和重写规则,或redirectmatch使

how to make it using rewriteCond and rewriteRule or redirectmatch

推荐答案

这将工作

# This will change all .php to .html
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]


# This will add .html to all urls that are not in the white list
# White list extensions php, html, css, js, less, jpg, png, gif
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|html|css|js|less|jpg|png|gif)$
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1.html

这篇关于如何使的.htaccess重定向各个环节为.html后缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 05:35