我有一个网站:blog.example.com。
我希望blog.example.com
转到example.com/news
但我希望blog.example.com/tag/mytag
或blog.example.com/category/mycategory
转到example.com/tag/mytag
或example.com/category/mycategory
到目前为止,我有这样的.htaccess,但当然它不起作用:
RewriteEngine on
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteRule ^(.*)$ http://www.example.com/news/ [R=301,L]
答案 0 :(得分:1)
您可以在blog.example.com
的根.htaccess中使用它:
RewriteEngine on
RewriteRule ^/?$ http://www.example.com/news [R=301,L]
RewriteRule ^(.+)$ http://www.example.com/$1 [R=301,L,NE]