ThinkPHP questions about url rewriting on SAE

Source: Internet
Author: User
ThinkPHP in SAE about url rewriting thinkphp. The root directory contains config. yaml (because SAE does not support. htaccess) content: name: & nbsp; thinktestversion: & nbsp; 1 handle: & nb ThinkPHP url rewriting in SAE
Thinkphp.
The root directory contains config. yaml (because SAE does not support. htaccess)
Content:

Name: thinktest
Version: 1
Handle:
-Rewrite: if (! Is_dir ()&&! Is_file () & path ~ "^ (. *) $") Goto "/index. php/$1"
-Rewrite: if (path ~ "^/Test \. html $") goto "/test. php"

The key is the second rewrite.
The root directory contains test.html and test. php.
When using test.html, you can access test. php.

The problem is
There is an entry file index. php
Action contains the file IndexAction. class. php.
The index operation code is as follows:

Echo" ";
Echo "location = '". APP_PATH. "Tpl/default/Index/test.html ';";
Echo "script";

That is, page jump.
Test.html and test. php are available under Tpl/default/Index /.
After the jump, the system will not access test. php.

If it is test.html under the root directory, it will be okay.

Is it related to the scope of config. yaml? Is there another reason?

Answers from experts!
------ Solution --------------------
The pseudo-static state of thinkphp is implemented through PATH_INFO.
The only thing that requires url rewriting is to hide the index. php file name.

Thinkphp is a single portal, so there will be no URLs such as http: // serverName/test. php

This either from
. Htaccess
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
Or config. yaml
-Rewrite: if (! Is_dir ()&&! Is_file () & path ~ "^ (. *) $") Goto "index. php/$1"
It can be seen that he converts all content outside the domain name to the index. php parameter.

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.