正务库

Emlog下二级域名绑定子目录伪静态规则

时间:2年前   游览量:243    标签: nbsp   

这里说的二级域名绑定子目录,是指在主域名对应空间根目录装了EMLOG程序的情况,并且是linux+apache环境。我们想让二级域名指向子目录实现访问,就需要修改一下伪静态规则。首先,在你的空间管理平台中绑定二级域名(通常说接收)如:daohang.shuyong.net,同时域名也要做好解析工作(一般可以用*号泛解析), 剩下的就是配置.htaccess文件了,直接打开根目录下的.htaccess文件可以看到如下代码:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule . /index.php [L]
</IfModule>

现在我们以指定daohang.shuyong.net指向/daohang/目录为例修改以上代码:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.shuyong.net$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule . /index.php [L]

RewriteCond %{HTTP_HOST} ^daohang.shuyong.net$
RewriteCond %{REQUEST_URI} !^/daohang/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /daohang/$1
RewriteCond %{HTTP_HOST} ^daohang.shuyong.net$
RewriteRule ^(/)?index.php$ daohang/index.html [L]
</IfModule>