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. /host/users/myaccount/htdocs/mycompany在 htdocs:或等效项中创建子目录
  2. 备份 .htaccess ,总是更好
  3. 将以下行添加到.htaccess文件中:
RewriteCond %{HTTP_HOST} ^mycompany\.basecamp\.com
RewriteCond %{REQUEST_URI} !^/mycompany/?
RewriteRule ^(.*)$ /mycompany/$1 [L]

这将捕获对第三级域的每次调用并使用子文件夹中的文件进行应答

于 2013-06-16T05:34:03.587 回答