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

如何使 htaccess 将 .php 或 seo 链接(不带扩展名)重定向到 .html

如何使用 rewriteCond 和 rewriteRule 或 redirectmatch

4

1 回答 1

0

这将起作用

# 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
于 2012-12-21T12:44:31.313 回答