Configure multiple domain names and bind second-level domain names in apache

Source: Internet
Author: User
1. Set in httpd. conf: ServerName110.110.110.000 # the IP address is the IPNameVirtualHost110.110.110.0002. configure the domain name and second-level domain name # implement second-level domain name authorization: tolowerRewriteMapvhosttxt: kncmsv

1. in httpd. set in conf: ServerName 110.110.110.000 # the IP address is the IP NameVirtualHost 110.110.110.000 you applied. configure domain name and second-level domain name # implement second-level domain name IfModule mod_rewrite.c RewriteMap lowercase int: tolower RewriteMap vhost txt:/kncms/vhost. map # Content

1. Set in httpd. conf:

ServerName 110.110.110.000 # Where IP is the IP address you applied
NameVirtualHost 110.110.110.000

2. Configure the domain name and second-level domain name

# Implementing second-level domain names


RewriteMap lowercase int: tolower
RewriteMap vhost txt: /Kncms/vhost. map# Content later
RewriteCond $ {lowercase: % {SERVER_NAME} ^ (. +) $
RewriteCond $ {vhost: % 1} ^ (/. *) $
RewriteRule ^/(. *) $ % 1/$1


DocumentRoot indicates the disk path where the program is stored.
ServerName indicates Domain Name


DocumentRoot/cms/
ServerName Domain Name


DocumentRoot/cms/
ServerName Level 1 domain name. com


DocumentRoot/cms/discuz/
ServerName bbs. First-level domain name. com # second-level domain name must have a top-level domain name to have second-level domain name

# Jump to a static page

RewriteEngine On
RewriteRule ^ (. *)/archiver/(fid | tid)-[/w/-00000000.html) $1/archiver/index. php? $2
RewriteRule ^ (. *)/forum-(%0-9%%*-(%0-9%%%%%%%.html $1/forumdisplay. php? Fid = $2 & page = $3
RewriteRule ^ (. *)/thread-(0-9000000000000-(0-9000000000000-(0-90000000000000000.html $1/viewthread. php? Tid = $2 & extra = page/% 3D $4 & page = $3
RewriteRule ^ (. *)/space-(username | uid0000-(.20.0000.html $1/space. php? $2 = $3


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

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

Vhost. map Content

Www.edukn.cn/cms/
Www.edukn.com/cms/
Bbs.edukn.com/cms/discuz/
Home.edukn.com/cms/uchome/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.