> php教程 > php手册 > 본문

apache 配置多个域名和二级域名绑定

WBOY
풀어 주다: 2016-06-06 20:01:15
원래의
2230명이 탐색했습니다.

1.在httpd.conf中设置: ServerName 110.110.110.000 #其中IP就是你申请的IP NameVirtualHost 110.110.110.000 2.配置域名和二级域名 #实现二级域名 IfModule mod_rewrite.c RewriteMap lowercase int:tolower RewriteMap vhost txt: /kncms/vhost.map #内容

 

1.在httpd.conf中设置:

ServerName 110.110.110.000  #其中IP就是你申请的IP
NameVirtualHost 110.110.110.000

2.配置域名和二级域名

 

 #实现二级域名


RewriteMap lowercase int:tolower
RewriteMap vhost txt:/kncms/vhost.map #内容在后面
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1


其中 DocumentRoot 表示程序存放的磁盘路径。
ServerName  表示域名


  DocumentRoot /cms/ 
  ServerName   域名


  DocumentRoot /cms/
  ServerName   一级域名.com


  DocumentRoot /cms/discuz/
  ServerName   bbs.一级域名.com  #二级域名 必须有顶级域名才能有二级域名 

 

#静态页实现跳转

RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[/w/-]+/.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)/.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)/.html$ $1/viewthread.php?tid=$2&extra=page/%3D$4&page=$3
RewriteRule ^(.*)/space-(username|uid)-(.+)/.html$ $1/space.php?$2=$3

 


  DocumentRoot /kncms/uchome/
  ServerName   home.edukn.com

RewriteEngine On
RewriteRule /(space|network)/-(.+)/.html$ /$1.php?rewrite=$2 [L]
RewriteRule /(space|network)/.html$ /$1.php [L]
RewriteRule /([0-9]+)$ /space.php?uid=$1 [L]

 

 

 

vhost.map 内容

 

www.edukn.cn /cms/
www.edukn.com /cms/
bbs.edukn.com /cms/discuz/
home.edukn.com /cms/uchome/

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!