【问题标题】:apache url rewrite from sub directory to sub domainapache url从子目录重写到子域
【发布时间】:2014-03-04 23:57:37
【问题描述】:

您能否建议一组 Apache 重写规则来将 domain.com/app 转换为 app.domain.com?重写规则应该对任何应用程序名称和指定的任何子路径都有效。例如,脚本应该能够以通用方式将 domain.com/otherapp/view.do 转换为 otherapp.domain.com/view.do。非常感谢。

【问题讨论】:

    标签: apache rewrite subdomain subdirectory


    【解决方案1】:
    RewriteCond %{HTTP_HOST} domain\.com [NC]
    RewriteRule ^/([A-Za-z0-9-]+)/(.*)$ http://$1.domain.com/$2 [L,R]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 2015-08-04
      相关资源
      最近更新 更多