thinkphp 5.0 Domain Name Routing

Source: Internet
Author: User
Tags subdomain

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.