【发布时间】:2016-01-21 12:00:18
【问题描述】:
我的网站有文档根 ~/public_html 我正在尝试使用 htaccess 组织多域/子域重定向。
可能的重定向逻辑:如果找到域/子域目录 - 执行重定向,否则抛出 404 错误。
可能的目录结构:
public_html/
.htaccess (main redirect router)
public_html/
domain-1/
application/
public_html/
.htaccess
public_html/
domain-2/
application/
public_html/
.htaccess
public_html/
domain-3/
application/
public_html/
.htaccess
public_html/
subdomain-1.domain-1/
application/
public_html/
.htaccess
public_html/
subdomain-2.domain-1/
application/
public_html/
.htaccess
非常感谢您的帮助。 谢谢。
【问题讨论】:
-
这就是 VirtualHosts 的优势所在。 httpd.apache.org/docs/2.2/en/vhosts
-
很遗憾,根据我的主机限制,我无法访问 apache 设置。
-
仅使用 htaccess 可以解决我的问题吗?
-
取决于您的主机。您是否有权使用可以将新域添加到托管包的工具?
-
apache 必须以某种方式将您的域映射到您的网络空间。这只是在虚拟主机 afaik 中。
标签: php .htaccess mod-rewrite redirect