将site.com/board重定向到newsite.com

时间:2019-04-30 21:42:00

标签: apache .htaccess mod-rewrite

我需要在保留结构和所有参数的同时,将请求从“ site.com/board”重定向(通过htaccess重写)到“ newsite.com”。告诉我如何正确做? 旧结构清单(site.com):

1. site.com/board/category 
2. site.com/board/category/subcategory
3. site.com/board/category/subcategory/city
4. site.com/board/category/subcategory/city?someparam=1&param=2...
and other site.com/board/register (login, page, terms...)

是否有通用解决方案 我应该用.htaccess写什么?

1 个答案:

答案 0 :(得分:0)

我找到了:)

RewriteCond %{REQUEST_URI} ^/board/(.*)$ 
RewriteRule ^(.*)$ https://newsite.com/%1 [R=301,L]