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

  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]

One Comment

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

    [回复]

    Daemon Toools said on: 2009-07-24 20:32

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*

Type your comment out:

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!: