如何将具有路径的子域重定向到没有此路径的根域

问题描述 投票:0回答:1

在这种情况下我需要帮助

我需要重定向(301)子域test.example.com/?preview_theme=niss-promaghttps://example.com而没有/?preview_theme=niss-promag

我已经使用过代码,但是它使用相同的路径https://example.com/?preview_theme=niss-promag重定向到根域>

这是当前使用的代码:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^test.example.com$
RewriteRule ^(.*)$ https://example.com [L,R=301]

注意:我需要将子域的任何路径重定向到我未指定的根域!

我需要在这种情况下提供帮助,我需要将(301)子域test.example.com/?preview_theme=niss-promag重定向(https)到https://example.com,而无需/?preview_theme = niss-promag我已经使用过代码,但是这是...

.htaccess redirect mod-rewrite url-rewriting subdomain
1个回答
0
投票

这应该起作用:

© www.soinside.com 2019 - 2024. All rights reserved.