htaccess重写文件夹 - 破折号到.html

时间:2014-04-22 23:20:14

标签: .htaccess rewrite

我需要将folder.html重写为文件夹/ 我怎么能这样做?

我试过:

RewriteEngine on
RewriteRule ^folder.html(.*) folder/$1

但它不能正常工作

1 个答案:

答案 0 :(得分:0)

这应该将folder.html重写为folder/

RewriteEngine on
RewriteBase /
RewriteRule ^folder.html folder/ [L,R=301]

编辑:

RewriteEngine on
RewriteBase /
RewriteRule ^folder/ folder.html [L,R=301]

另一个编辑:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteBase /
RewriteRule ^folder/ folder.html [L,R=301]