从子目录子域的Apache URL重写 [英] apache url rewrite from sub directory to sub domain
本文介绍了从子目录子域的Apache URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您能否提供的一组Apache重写规则转换为domain.com/app app.domain.com?重写规则应适用于任何应用程序的名称和所有指定的子路径。例如,脚本应该能够转换domain.com/otherapp/view.do一种通用的方式来otherapp.domain.com/view.do~~V。大部分AP preciate。
解决方案
的RewriteCond%{HTTP_HOST}域\\ .COM [NC]
重写规则^ /([A-ZA-Z0-9 - ] +)/ $ HTTP(*)://$1.domain.com/$2 [L,R]
Can you suggest a set of Apache rewrite rules to convert domain.com/app to app.domain.com? The rewrite rules should be valid for any app name and any sub path specified. For example, the script should be able to convert domain.com/otherapp/view.do to otherapp.domain.com/view.do in a generic fashion. Much appreciate.
解决方案
RewriteCond %{HTTP_HOST} domain\.com [NC]
RewriteRule ^/([A-Za-z0-9-]+)/(.*)$ http://$1.domain.com/$2 [L,R]
这篇关于从子目录子域的Apache URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文