0

我目前有一个重写规则,将 *.domain.com 重写为 www.domain.com(blog.domain.com 除外)

RewriteEngine On RewriteCond %{HTTP_HOST} ^domain.com$ [NC]

RewriteRule ^(.*)$ http://www.domain.com $1 [R=301,L]

我想将我的所有 URL 从子域重写到根域,同时保留页面名称,添加“.html”扩展名,并添加 [301] perm 标签:

blog.domain.com/my-first-link  -->  www.domain.com/blog/my-first-link.html 
blog.domain.com/my-second-link -->  www.domain.com/blog/my-second-link.html
4

1 回答 1

1
RewriteEngine on
RewriteRule ^(.*) http://www.domain.com/blog/$1.html [R=301,L]
于 2012-05-11T21:39:10.767 回答