Home  >  Article  >  PHP Framework  >  Introducing thinkPHP to configure virtual domain names and simplify URL paths

Introducing thinkPHP to configure virtual domain names and simplify URL paths

藏色散人
藏色散人forward
2021-04-22 11:50:252318browse

The tutorial column of thinkphp below will introduce thinkPHP to configure a virtual domain name and simplify the URL path. I hope it will be helpful to friends in need!

Introducing thinkPHP to configure virtual domain names and simplify URL paths

1. Open httpd.conf under apache, remove the # before the sentence Include conf/extra/httpd-vhosts.conf, and enable httpd-vhosts under extra .conf

2. Open httpd-vhosts.conf,

    
        DocumentRoot "D:\workspace\PHP\thinkPHP\tp5full\public"(入口文件所在目录)
        ServerName z.cn(虚拟域名)
    

3. Add 127.0.0.1 z.cn (that is, the virtual domain name) in the host file.

Restart Apache. .

Existing problems:

1. Enter localhost in the browser, and you will find that the directory where the entry file is located is opened, which will affect the development of other projects.

Solution:

1. Open httpd-vhosts.conf,

    
        DocumentRoot "D:\workspace\PHP"(网站根目录)
        ServerName localhost
    

.

Related recommendations: The latest 10 thinkphp video tutorials

The above is the detailed content of Introducing thinkPHP to configure virtual domain names and simplify URL paths. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete