Method of two-level domain binding level two directory in CentOS

Source: Internet
Author: User
Keywords Level two domain name

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

For some directories, we often need to specify a level two domain name, then how to operate?

Because of my first contact with CentOS, I had to use network resources. Then know to open mod_rewrite This module, the specific method is as follows:

Open the Apache installation directory with a text editor/etc/httpd/conf\httpd.conf, find the "#LoadModule rewrite_module modules/mod_rewrite.so" line, remove the front "#"; Continue to find "allowoverride None", modify it to "allowoverride all", and then restart Apache.

So, it opens the Mod_rewrite module, its function is very powerful, here I only talk about how to bind the level two domain name.

Again, we enter the following statement at the end of the httpd.conf file:

Rewriteengine on

Rewritemap lowercase Int:tolower

Rewritemap Vhost Txt:/etc/httpd/vhost.map

Rewritecond ${lowercase:%{server_name} ^ (. +) $

Rewritecond ${vhost:%1} ^ (/.*) $

Rewriterule ^/(. *) $%1/$1

and restart Apache.

In this way, we are free to set the binding level two domain name.

Warm tip: This httpd.conf everyone pay attention to backup, I have accidentally deleted, made extremely miserable ah!!

Then create a new Vhost.map in the/ETC/HTTPD (that is, the Apache installation directory) and bind with a text editor, which is very simple, as I wrote:

Bbs.nvdchina.com/var/www/html/bbs

Home.nvdchina.com/var/www/html/home

Potplayer.nvdchina.com/var/www/html/potplayer

We can bind the level two domain name to the directory, save on the line, and do not need to restart Apache, very convenient.

Related Article

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.