Pathinfo mode and URL rewriting in ThinkPHP

Source: Internet
Author: User
The Chinese language has never been very good. I really don't know how to explain this pathinfo mode. let's talk about the pathinfo mode in a piece of code. 1 http: // serverName/appName/module/action/id/1/This is the first parameter in pathinfo mode without considering routing... "/> <scripttype =" text language has never been very good. I really don't know how to explain this pathinfo mode. let's talk about the pathinfo mode in a piece of code. 1 http: // serverName/appName/module/action/id/1/This is the pathinfo mode, the first parameter will be parsed into the module name (if grouping is enabled, it will be rolled back in turn), the second parameter will be parsed into an operation, and the subsequent parameters will be passed explicitly, and must appear in pairs, such as: 1 http: // serverName/appName/module/action/y Ear/2008/month/09/day/21/the usual URL contains index. php, in order to achieve better SEO effect, you may need to remove the index in the URL. php, which can be achieved through URL rewriting, usually requires the server to enable the URL_REWRITE module. The following is the configuration process of Apache. for details, refer to: 1. httpd. the mod_rewrite.so module is loaded in the conf configuration file. 2. replace AllowOverride None with All3, make sure that URL_MODEL is set to 24, and save the following content. put the htaccess file in the same directory of the entry file. 2 RewriteEngine on3 RewriteCond % {REQUEST_FILENAME }! -D4 RewriteCond % {REQUEST_FILENAME }! -F5 RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L] 6 Never touched again. the htacces file can be Baidu. here we will remind you that the saved file name is. htaccess, which may only look like a suffix. do not add a *** in front of it ***. htaccess. After Apache is restarted, the original http: // serverName/index. php/Blog/read/id/1 can simplify the URL address by accessing 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.