【问题标题】:htaccess redirect subfolder to subdomainhtaccess 将子文件夹重定向到子域
【发布时间】:2012-11-23 22:34:58
【问题描述】:

我在 Linux 服务器上运行 Apache mod_rewrite,我需要将子文件夹重定向到子域并从 url 中删除子文件夹。例如:

http://www.mydomain.com/forum/forum_posts.asp?TID=11816&PID=252908&title=pouch-information-day-the-next-one#252908

需要重定向到

http://subdomain.mydomain.com/forum_posts.asp?TID=11816&PID=252908&title=pouch-information-day-the-next-one#252908

有人可以帮忙吗?

【问题讨论】:

    标签: linux apache .htaccess mod-rewrite


    【解决方案1】:

    Apache URL Rewriting Guide 是一个很好的参考。我会这样做:

    RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www.mydomain.com/forum/
    RewriteRule ^/forum/(.*) http://subdomain.mydomain.com/$1 [L,R]
    

    【讨论】:

      猜你喜欢
      • 2013-11-08
      • 1970-01-01
      • 2014-03-17
      • 1970-01-01
      • 2012-01-09
      • 2013-12-03
      • 2012-09-17
      • 1970-01-01
      • 2011-10-14
      相关资源
      最近更新 更多