我有一個關於指向子域到一個目錄的兩個問題:指向子域的「目錄」
目前我跑的地方,但我可以在我成立了一個假的域中運行我的網站(與主機文件),其名爲mysite.com。我怎麼能(通過服務器設置?)這樣做所有子域將指向/?示例anders.mysite.com也應顯示mysite.com和asdassdd.mysite.com。
也許1.沒有必要,但我如何通過htaccess將anders.mysite.com指向mysite.com/anders?重要提示是不應該重定向。
爲什麼我認爲的1,是因爲我不想在htaccess的或任何Apache /域設置,該子域是什麼的任何位置指定,因爲這將是動態的(創建由已登錄的用戶在我webapplication)
當前用戶可以使用mysite.com/anders/這是他們創建的URI,而不是真實的目錄。在Kohana bootstrap中,我抓取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]
任何幫助表示讚賞!
我的hosts文件有127.0.0.1 mysite.com和我的httpd-vhosts.conf現在有: <虛擬主機*:80> ServerAlias * .mysite.com 虛擬主機> 但我仍然無法達到blabla.mysite.com上的文檔根目錄。我錯過了什麼嗎? – Karem
爲了澄清,我的需求是,Kohana應該閱讀blah.mysite.com/page/stuff,因爲它是mysite.com/blah/page/stuff – Karem
因爲我不是真正的mysite。com,我用hosts文件讓瀏覽器認爲我是。 – Karem