Ask htaccess file rules

Source: Internet
Author: User
There are two requirements. 1. http automatically jumps to https2.index. php to block the thinkphp framework. There are two Thanks requirements.
1. http automatically redirects to https
2. Disable index. php and use the thinkphp framework.

Thanks

Reply content:

There are two requirements.
1. http automatically redirects to https
2. Disable index. php and use the thinkphp framework.

Thanks

We recommend that you view the relevant documentation. The http://www.htaccesseditor.com/ SC .shtml here provides a web that can be generated online.

Supplement: http://hi.baidu.com/honfei/item/0893a6e12984903a4ddcafbc

1. Redirect http directly to https

RewriteEngine onRewriteCond %{SERVER_PORT} !^443$RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]

2. TP shields index. php
For Apache, you must add the. htaccess file at the same level as the entry file. The content is as follows:


  
   RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  

Nginx Environment
In earlier versions of Nginx, PATHINFO is not supported, but you can configure forwarding rules in Nginx. conf:

Location /{//..... Omit part of the Code if (! -E $ request_filename) {rewrite ^ (. *) $/index. php? S = $1 last; break ;}}

ThinkPHP manuals are described. You are advised to take a closer look :)

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.