【发布时间】:2014-01-28 13:01:12
【问题描述】:
关于将子域指向目录,我有两个问题:
目前我在本地运行,但我可以在我设置的假域上运行我的站点(使用 hosts 文件),它名为 mysite.com。我怎么能(通过服务器设置?)这样做所有子域都指向 / ?示例 anders.mysite.com 也应显示 mysite.com 和 asdassdd.mysite.com。
也许 1. 没有必要,但是我如何通过 htaccess 点 anders.mysite.com 到 mysite.com/anders ?重要的通知是不应该重定向。
为什么我想到 1. 是因为我不想在 htaccess 或任何 apache/domain 设置中的任何地方指定子域是什么,因为这将是动态的(由我的 web 应用程序中的登录用户创建)
目前用户可以使用 mysite.com/anders/ 这是他们创建的 URI,而不是真正的目录。然后在 Kohana 引导程序中,我抓取 URI 并显示相关的用户页面。
我正在使用 Kohana MVC 框架,并且在我的 htaccess 中有这个:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
任何帮助表示赞赏!
【问题讨论】: