2

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!

4

1 に答える 1

4
  1. htdocs:/host/users/myaccount/htdocs/mycompanyまたは同等のサブディレクトリを作成します。
  2. .htaccess をバックアップしてください。
  3. .htaccess次の行をファイルに追加します。
RewriteCond %{HTTP_HOST} ^mycompany\.basecamp\.com
RewriteCond %{REQUEST_URI} !^/mycompany/?
RewriteRule ^(.*)$ /mycompany/$1 [L]

これにより、第 3 レベルのドメインへのすべての呼び出しがキャッチされ、サブフォルダーのファイルで応答されます。

于 2013-06-16T05:34:03.587 に答える