PathInfo mode and URL rewriting in thinkphp

Source: Internet
Author: User
Chinese has been not very good, how do I explain this pathinfo mode is really don't know how to say, then first a piece of code said pathinfo mode bar 1 http://serverName/appName/module/action/id/1/ This is the PathInfo mode, without considering routing, the first argument is parsed into the module name (if grouping is enabled, then recursively), the second argument is parsed into action, the subsequent arguments are explicitly passed, and must appear in pairs, for example: 1 http:// servername/appname/module/action/year/2008/month/09/day/21/ The usual URL contains index.php, in order to achieve better SEO effect may need to remove the URL inside the index.php, through the way of URL rewriting can achieve this effect, usually requires the server to open Url_rewrite module to support. The following is the Apache configuration process, can refer to the following: 1, httpd.conf configuration file loaded with Mod_rewrite.so Module 2, allowoverride None to all 3, ensure Url_model set to 2 4, Save the following to the. htaccess file in the same sibling directory as the portal file 1 <ifmodule mod_rewrite.c> 2 rewriteengine on 3 Rewritecond%{request_filename}! -D 4 Rewritecond%{request_filename}!-f 5 Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l] 6 </IfModule> No contact for the reset. htacces   The file can be some Baidu, here to remind you, save the filename is. htaccess, it may seem only suffix, that is, don't add a ***.htaccess to the front. After restarting Apache, the original http://serverName/index.php/Blog/read/id/1 can simplify the URL address by accessing the HTTP://SERVERNAME/BLOG/READ/ID/1

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.