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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?