专业WordPress主机提供商

利用.htaccess绑定域名到子目录

2009-03-19
  1.  
    1. RewriteEngine on
    2. # 把 yourdomain.com 改为你要绑定的域名.
    3. RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
    4. # 把 subfolder 改为要绑定的目录.
    5. RewriteCond %{REQUEST_URI} !^/subfolder/
    6. # 不要改以下两行.
    7. RewriteCond %{REQUEST_FILENAME} !-f
    8. RewriteCond %{REQUEST_FILENAME} !-d
    9. # 把 subfolder 改为要绑定的目录.
    10. RewriteRule ^(.*)$ /subfolder/$1
    11. # 把 yourdomain.com 改为你要绑定的域名
    12. # 把 subfolder 改为要绑定的目录.
    13. # subfolder/ 后面是首页文件index.php, index.html……
    14. RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
    15. RewriteRule ^(/)?$ subfolder/index.php [L]
作者:小张 | 分类目录:Apache & MySQL & PHP | 标签:

2 条评论

  1. Daemon Toools 说道:

    这样一个主机上就可以挂很多站了,难道~~

  2. 不会鼓励大家用这个多建站吧…………

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>