利用.htaccess绑定域名到子目录
2014年09月16日 ⁄ 电脑相关 ⁄ 共 449字
- RewriteEngine on
- # 把 yourdomain.com 改为你要绑定的域名.
- RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
- # 把 subfolder 改为要绑定的目录.
- RewriteCond %{REQUEST_URI} !^/subfolder/
- # 不要改以下两行.
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- # 把 subfolder 改为要绑定的目录.
- RewriteRule ^(.*)$ /subfolder/$1
- # 把 yourdomain.com 改为你要绑定的域名
- # 把 subfolder 改为要绑定的目录.
- # subfolder/ 后面是首页文件index.php, index.html……
- RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
- RewriteRule ^(/)?$ subfolder/index.php [L]
哈哈,有意思。