Home> PHP Framework> ThinkPHP> body text

Introducing thinkPHP to configure virtual domain names and simplify URL paths

藏色散人
Release: 2021-04-25 08:52:46
forward
2384 people have browsed it

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!

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(虚拟域名) 
Copy after login

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 
Copy after login

.

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!

Related labels:
source:csdn.net
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!