Example of setting a domain name alias for a HTTPD-VHOSTS

Source: Internet
Author: User
Tags aliases

In Apache's httpd-vhosts, you can configure a virtual host domain name or set a domain name alias, such as the domain name www.111cn.net. You can set one or more domain name aliases for it to be accessed through 111cn.net.


This is defined in the httpd-vhosts.conf as follows:

PHP

<VirtualHost *: 80>
DocumentRoot "/xampp/htdocs/yii2/frontend/web"
ServerName www.111cn.net
ServerAlias www.111cn.net 111cn.net ErrorLog "logs/www.111cn.net-error. log"
CustomLog "logs/www.111cn.net-access. log" combined
</VirtualHost>
ServerAlias can be used to set domain name aliases or regular expressions, such as www. yii *. com.

Add hosts at the same time:

PHP


127.0.0.1 www.111cn.net
127.0.0.1 111cn.net

Restart apache and use the domain name alias to access the original domain name.

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.