Thinkphp supports routing and binding capabilities for full domain names, sub-domains, and IP deployments
To enable the Domain name Deployment routing feature, you first need to turn on:
' Url_domain_deploy ' = true
There are two ways to define domain name deployment rules: Dynamic registration and configuration definitions. We are now mainly talking about dynamic registration in this way.
Dynamic registration
You can dynamically register domain name deployment rules in your app's public files or in configuration files, such as:
Blog sub-domain binding to the blog module route::d omain (' blog ', ' blog ');//full domain Binding to admin module Route::d omain (' admin.thinkphp.cn ', ' admin ');// IP binding to admin module Route::d omain (' 114.23.4.5 ', ' admin ');
After the blog subdomain is bound, the URL access rule becomes:
The original URL access http://www.thinkphp.cn/blog/article/read/id/5//bound to the blog subdomain access HTTP://BLOG.THINKPHP.CN/ARTICLE/READ/ID/5
thinkphp 5.0 Domain Name Routing