A brief talk on Thinkphp's URL rewriting and thinkphpurl_php tutorial

Source: Internet
Author: User

A brief talk on Thinkphp's URL rewriting and Thinkphpurl


All I wanted was to get rid of the index.php in the URL path.

The first is the configuration. htaccess

Copy the Code code as follows:

Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]

Because I'm deploying on Apache, I need to find LoadModule rewrite_module in the httpd.conf config file modules/mod_rewrite.so remove the previous #, Find allowoverride None and change to allowoverride all.

Now access localhost/product valid, but __app__ or __url__ or you get out of the path contains index.php, that is, localhost/index.php, there is a step, need in conf/ Config.php inside Modify or add ' Url_model ' =>2,

And because I was trying to deploy the thinkphp-based Conist Enterprise Edition 2.0, there was a configuration of ' Url_model ' =>c (' token.false_static ') in config.php, and Token.false_ The value of static is set to 1 at initialization, so ... Mode is still 1,pathinfo mode.

in the Sina SAE deployment , does not support. htaccess, only supports its own profile config.yaml, so add the following rewrite format code to CONFIG.YAML:

Copy the Code code as follows:
Handle
-Rewrite:if (!is_dir () &&!is_file () && path~ "^ (. *) $") goto "index.php/$1"

is not super simple, if you want to learn more about other pseudo-static aspects of knowledge, please read the following article recommended it.

http://www.bkjia.com/PHPjc/917034.html www.bkjia.com true http://www.bkjia.com/PHPjc/917034.html techarticle talking about the URL rewriting of thinkphp, talking about thinkphpurl the result I want is to remove the index.php in the URL path first is the configuration. htaccess Copy the code code as follows: Ifmodule mod_rewrite.c ...

  • 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.