thinkphp learning _4 in URL mode

Source: Internet
Author: User

thinkphp has four URL modes:

0 Normal Mode http://localhost/imooc/index.php?m=Index&a=user&id=1

Normal mode is the traditional get parameter to specify the current access to the module and operation, there is a conflict between M and other page backend values are either, back-end value method, or rewrite the naming of different patterns

// The default module gets the variable // default controller Get variable // default action gets variable

1 default mode pathinfo mode http://localhost/imooc/index.php/Index/user/id/1.html

Provides the best SEO support, the system has already done the environment compatibility processing, so can support most host environment:

Modifying the split configuration of/controller/action/params.html‘URL_PATHINFO_DEPR‘=>‘-‘,

2 rewrite mode http://localhost/imooc/Index/user/id/1.html

Rewrite mode is a son Ah pathinfo on the basis of a further improvement: You can remove the URL address inside the portal file index.php, but need to configure additional Web server rewrite rules.

Apache will need to add the. htaccess file to the sibling of the portal file:

<ifmodule mod_rewrite.c>%{request_filename}-%{request_filename}-^ (. *) $ index.php/$1 [Qsa,pt,L]</IfModule>


3 Compatibility Mode http://localhost/imooc/index.php?s=/Index/user/id/1.html

Compatibility mode, in conjunction with the definition of a Web server rewrite rule, can achieve the same URL effect as rewrite mode.

Apache's. htaccess Configuration notation

<ifmodule mod_rewrite.c>%{request_filename}-%{request_filename}-^ (. *) $ index.php?s=/$1 [Qsa,pt,L]</IfModule>

thinkphp learning _4 in URL mode

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.