I would like to do a thing like that used in basecamp.com: the name of your company becomes a third-level domain, http://mycompany.basecamp.com for example. I understand that it is (most likely) made on the basis of .htaccess file and mod_rewrite, but I do not quite understand how exactly. Please advise me how it is implemented? Thanks in advance!
2213 次
1 に答える
4
- htdocs:
/host/users/myaccount/htdocs/mycompany
または同等のサブディレクトリを作成します。 - .htaccess をバックアップしてください。
.htaccess
次の行をファイルに追加します。
RewriteCond %{HTTP_HOST} ^mycompany\.basecamp\.com RewriteCond %{REQUEST_URI} !^/mycompany/? RewriteRule ^(.*)$ /mycompany/$1 [L]
これにより、第 3 レベルのドメインへのすべての呼び出しがキャッチされ、サブフォルダーのファイルで応答されます。
于 2013-06-16T05:34:03.587 に答える