Simple setup of ThinkPHP3 pseudo-static with URL rewrite multiple match

Source: Internet
Author: User
ThinkPHP3 simple settings for pseudo-static and URL rewrite multiple matches

Configure Apacheaccording to the section of the ThinkPHP3.0 manual URL rewrite.

Then place the . htaccess file in the root directory of the Web site, as indicated in the manual

Win2003 Space IIS6 does not support the. htaccess, choose the server of the Linux system as much as possible

?

 
  
   
  Rewriteengine Onrewritecond%{request_filename}!-drewritecond%{request_filename}!-fRewriteRule ^ (. *) $ index.php/$1 [QSA,PT,L] Reprint please specify the Source: http://tyllxx.iteye.com
 
  
?

?

Although pseudo-static can be implemented with Url_html_suffix, the method here is implemented using the. htaccess file.

The above code can be implemented so that:

Http://serverName/index.php/Blog/read/id/1

Into:

Http://serverName/Blog/read/id/1

?

Then let it become:

Http://serverName/Blog/1.html

?

If you have:

Http://serverName/buy/1.html

Http://serverName/topic/diy.html

How to achieve it?

?

Here is the implementation method: (. html suffix, you add yourself when writing a connection, in Url_html_suffix way, remove the method. html)

?

?

 
  
   
     Rewriteengine on   rewritecond%{request_filename}!-d   rewritecond%{request_filename}!-f   RewriteRule ^ (. *) $ index.php/$1 [qsa,pt]   rewriterule ^ (. *)/topic/(. *) \.html$ $1/topic/index/index/links/$2 [qsa,pt]   Rewriterule ^ (. *)/buy/(. *) \.html$ $1/buy/index/index/id/$2 [qsa,pt,l] Reprint please specify the Source: http://tyllxx.iteye.com
 
  
?

This method has been validated, and can only be used by modifying match fields and replacing fields.

  • Related Article

    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.