简体   繁体   English

htaccess将子域重定向到新域,而没有子域

[英]htaccess redirect subdomain to new domain WITHOUT subdomain

Almost there: 快好了:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^forums\.resistance\.tk  [NC]
RewriteRule ^(.*) https://www.libertaire.net/$1 [L,R=301]

this will redirect http://forums.resistance.tk/message.php?t=7751 to https://www.libertaire.net/forums/message.php?t=7758 but i want https://www.libertaire.net/message.php?t=7758 这会将http://forums.resistance.tk/message.php?t=7751重定向到https://www.libertaire.net/forums/message.php?t=7758,但是我想要https://www.libertaire达网络/ message.phpΔT= 7758

how can i achieve this? 我怎么能实现这个目标?

thanks 谢谢

In order to remove /forums/ while redirecting use this rule: 为了在重定向时删除/forums/ ,请使用以下规则:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^forums\.resistance\.tk$  [NC]
RewriteRule ^forums(/.*)?$ https://www.libertaire.net$1 [L,R=301,NC]

Make sure to clear your browser cache before testing this. 在测试之前,请务必清除浏览器缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM