httpd绑定二级域名的文件目录

第一步:

开启mod_rewrite模块,默认是开启的,这里可以查下是否开启。

第二步:

查看302行:“AllowOverride None” 修改成 “AllowOverride All”。

第三步:

在httpd.conf最后添加如下命令

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/etc/httpd/vhost.map
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1

第四部:

在目录 /etc/httpd/下创建目录 vhost.map 文件,用来绑定二级域名对应的目录。

文本内容填写如:bbs.baidu.com /var/www/html/bbs。

第五部:

重启apache服务器

终端输入:service httpd restart   回车,完成。

发表评论?

1 条评论。

  1. 第一步是将二级域名绑定到主机ip上

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.