douhui3330
douhui3330
2016-02-21 10:03
浏览 61
已采纳

htaccess将子域重定向到没有子域的新域

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

how can i achieve this?

thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dougan4884
    dougan4884 2016-02-21 14:32
    已采纳

    In order to remove /forums/ while redirecting use this rule:

    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.

    点赞 评论

相关推荐