Home php教程 php手册 Website deployment of first-level domain names, second-level domain names, and subdomain names

Website deployment of first-level domain names, second-level domain names, and subdomain names

Sep 23, 2016 am 03:30 AM

About domain name introduction:

Generally speaking, a complete domain name is composed of two or more parts, and each part is separated by an English period "." For example, "www.baidu.com", the right part of the last "." ".com" becomes the top-level domain name (TLD), and also becomes the first-level domain name, similar to .cn, .net, .org, .gov, . edu, .tv, etc. Here .com.cn is actually the second-level domain name under .cn). Any individual can register a .com domain name, of which baidu.com is the second-level domain name under the top-level domain name .com. baidu.com can also be in the form of image.baidu.com, music.baidu.com, and imagemusic here can Called a "subdomain name";

Apache configuration for second-level domain names and subdomains:

Enter Apache-conf-extra-httpd-vhost.conf and add the following configuration:

<span style="color: #0000ff;"><</span><span style="color: #800000;">VirtualHost </span><span style="color: #ff0000;">*:80</span><span style="color: #0000ff;">></span><span style="color: #000000;">
    DocumentRoot "E:/wamp/www/galaxyPHP/"
    ServerName  testimmi.com
    ServerAlias m.testimmi.com
    </span><span style="color: #0000ff;"><</span><span style="color: #800000;">Directory </span><span style="color: #ff0000;">"E:/wamp/www/galaxyPHP/"</span><span style="color: #0000ff;">></span><span style="color: #000000;">
    Allow from all      
    </span><span style="color: #0000ff;"></</span><span style="color: #800000;">Directory</span><span style="color: #0000ff;">></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">IfModule </span><span style="color: #ff0000;">dir_module</span><span style="color: #0000ff;">></span><span style="color: #000000;">
       DirectoryIndex  mobile.php index.html index.htm default.php default.htm default.html
    </span><span style="color: #0000ff;"></</span><span style="color: #800000;">IfModule</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"></</span><span style="color: #800000;">VirtualHost</span><span style="color: #0000ff;">></span>

<span style="color: #0000ff;"><</span><span style="color: #800000;">VirtualHost </span><span style="color: #ff0000;">*:80</span><span style="color: #0000ff;">></span><span style="color: #000000;">
    DocumentRoot "E:/wamp/www/galaxyPHP/"
    ServerName  testimmi.com
    ServerAlias www.testimmi.com
    </span><span style="color: #0000ff;"><</span><span style="color: #800000;">Directory </span><span style="color: #ff0000;">"E:/wamp/www/galaxyPHP/"</span><span style="color: #0000ff;">></span><span style="color: #000000;">
    Allow from all      
    </span><span style="color: #0000ff;"></</span><span style="color: #800000;">Directory</span><span style="color: #0000ff;">></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">IfModule </span><span style="color: #ff0000;">dir_module</span><span style="color: #0000ff;">></span><span style="color: #000000;">
       DirectoryIndex  index.php index.html index.htm default.php default.htm default.html
    </span><span style="color: #0000ff;"></</span><span style="color: #800000;">IfModule</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"></</span><span style="color: #800000;">VirtualHost</span><span style="color: #0000ff;">></span>
Copy after login

DocumentRoot represents the directory where the website project is located, ServerName represents the second-level domain name, and ServerAlias ​​is the alias (a complete second-level domain name (with www.) or a subdomain name is allowed),

In the ThinkPHP project, different module entries can be easily distinguished by configuring different entry files index.php and mobile.php. Combined with the .htaccess file, the routing URL can be simplified.

If the httpd-vhost.conf file configuration does not work, there are two points to note:

1. The http-vhosts.conf module is allowed to be loaded in the Apache configuration file httpd.conf:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2. Enable rewrite-module function;

In the test environment, you can configure the system host file and add

192.168.1.122 testimmi.com
192.168.1.122 m.testimmi.com
192.168.1.122 www.testimmi.com

Let’s simulate the situation of applying for a second-level domain name

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)