The tutorial column ofthinkphpbelow will introduce thinkPHP to configure a virtual domain name and simplify the URL path. I hope it will be helpful to friends in need!
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. .
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.
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!