Pagoda panel settings for Ngix and Apach server pathinfo when deploying thinkphp projects

Source: Internet
Author: User

A preface

Pagoda panel whether for Linux or Windows systems, a one-click Deployment solution, simple operation, without the need for complex programming skills, small white can complete a professional complex back-end deployment. For the THINKPHP5 frame provided by the pagoda, the development efficiency is greatly improved. Today, the PathInfo settings for URLs that are frequently used in the browser access address are analyzed and summarized.

The concept of two PathInfo

PathInfo is a URL form that is set by the thinkphp framework in order to simplify and visualize URLs.

This is illustrated today with the simplest control.

For example, a child

Http://tp5.com/index/index/index2

The domain name for the http://tp.com Access module is the index controller for the index method of Index2

The methods in TP5 are as follows:

Index2 method can take parameters, then add a parameter to see the effect

http://tp5.com/index/index/index2/a/I'm going to pass a parameter to variable a

See here, tp5 URL parameter is directly after the method name/variable/variable value

This is PATHINFO!!!

Then, throw away the TP5 pathinfo,tp3 and the traditional compatibility mode, is the complex URL to send parameters, very unfriendly, also not conducive to SEO.

The focus today is not on the operation of the TP5, but the path setup problem encountered by the pagoda panel at deployment time.

Three Ngix server PathInfo

Pagoda server comes with one-click Deployment Tp5 pathinfo Normal, Ngix version 1.8.

But if the frame downloaded from the TP5 website is copied to the pagoda site, path fails, the problem is found by comparison, click the Site settings, modify the following:

The site pseudo-static, write the following rules can be,

Location/{
if (!-e $request _filename) {
Rewrite ^ (. *) $/index.php?s=$1 last; Break
}
}

The hidden index.php file redirects the form variable s= to index.php.

Quad-Apach Server PathInfo

Pagoda comes with Apach version 2.4, in the TP5 framework, specifically a file is written to Apach read, called the. htaccess file, directory under the public folder

<ifmodule mod_rewrite.c>
Options +followsymlinks-multiviews
Rewriteengine on

Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php?/$1 [qsa,pt,l]
</IfModule>

Open the. htaccess., as modified above, turn on redirection. Note When hiding index.php, sometimes the Apach default is less, plus the number, pathinfo all normal.

Five native test

Pagoda all build station way for domain + port. If you want to edit the test locally in the window System, after you purchase the domain name, you need to bind the domain name to the local computer. Open the Hosts file under the following directory

127.0.0.1 tp.com

Indicates that when a native accesses the tp.com domain name, it accesses the native

Five summary

About PathInfo, online and forum, people see benevolence, benevolent see. The actual work, with the Pagoda panel to configure the server and website, the operation is relatively simple, easy to understand. summed up in fact, two points, respectively, modify the site under the configuration can be.

Ngix modifying pseudo-static

Apach modifying. htaccess files

Pagoda panel settings for Ngix and Apach server pathinfo when deploying thinkphp projects

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.