我目前有一条重写规则,将* .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]
我想将所有网址从子域重写到根域,同时保留页面名称,添加“.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
答案 0 :(得分:1)
RewriteEngine on
RewriteRule ^(.*) http://www.domain.com/blog/$1.html [R=301,L]