Simple implementation of loading different controllers in the pathinfo mode of PHP url, urlpathinfo
The pathinfo mode and common url mode are implemented by calling different controllers by automatically loading and parsing url parameters.
File
Configuring Nginx support for thinkphp URL rewriting and PathInfo
Thinkphp supports the use of pathinfo and URL rewrite to provide a friendly URL, just set the ' Url_model ' + 2 in the configuration file. Under Apache only need to open the
The most streamlined nginx configurationServer {Listen80; SERVER_NAME Test.com; CharSet UTF-8; Location/{root E:/www/test; Index index.PHP; if(!-E$request _filename) { #Be sure to use (. *) to match the entire URI, including the first
Chinese has been not very good, how can I explain this pathinfo mode is really don't know how to say, then first a piece of code said PathInfo mode bar Code as follows: http://serverName/appName/module/action/id/1/ This is PathInfo mode
Reason
For a long time not using Apache, and gradually to Apache strange, because friends have a zendframework frame from Apache moved to Nginx, need pathinfo mode support.
Online Sea Search
So began to search Nginx+pathinfo related articles, a
Php uses the pathinfo (), parse_url (), and basename () functions to parse the URL, pathinfobasename
This document describes how to use functions in php.pathinfo(),parse_url()Andbasename()The instance code for URL Parsing. Let's just look at the
First of all, it may not be related to the thinkphp framework route Parsing Code. If you are interested, you can test {code ...} the above code is part of the output in the project entry file $ _ SERVER information. When apache enables pseudo-static
This article mainly introduces the Nginx server configuration PathInfo mode (to solve the dolphin PHP background infinite redirection problem), has a certain reference value, now share to everyone, the need for friends can refer to
server {Listen 80
Nginx environmental problems for two days, found online a lot of people's posts are either copied or pasted, or there is no knot paste, but also write their own "Haha, I solve their own" and so on, I despise these postings of compatriots, you said
ThinkPHP supports providing friendly URLs through PATHINFO and URLrewrite. you only need to set URL_MODEL & gt; 2 in the configuration file. In Apache, you only need to enable the mod_rewrite module for normal access, but PATHINFO is not supported
Questions and principles can be consulted: http://www.laruence.com/2009/11/13/1138.html
If you are using the Lnmp script one-click installation of the development environment, you can open a pathinfo as follows:
1. Note the try_files in
What I know and can be successful is through rewrite redirection. But I learned from the Bird's blog that there is another way to set rewrite? What is the principle of the rewrite redirection method mentioned in the blog? What I know and can be
First of all, it might be irrelevant to the thinkphp framework routing parsing code, so if you're interested, you can test it.
["REQUEST_URI"]=> string(19) "/Wgh/Wgh/index.html" ["SCRIPT_NAME"]=> string(10) "/index.php" ["PATH_INFO"]=> string(19) "/
Thinkphp supports providing friendly URLs through pathinfo and URL rewrite. You only need to set 'url _ model' => 2 in the configuration file. In Apache, you only need to enable the mod_rewrite module for normal access, but pathinfo is not supported
I simply wrote a php function to process the normal url mode and change the pathinfo mode /**
* @ Category url_type this method is used to process the url mode pathinfo mode.
*/
Function url_type (){
// Url mode controller -- method acquisition
Nginx pathinfo that supports thinkphp now finds two problems:
1 does not support PATHINFO.
Localhost /? M = login is accessible, while localhost/login is not.
2. the address generated by the U method of THINKPHP is incorrect.
The address generated
Nginx configuration PathInfo Hidden index.phpPut this code in the Nginx configuration file
server {
listen ;
Default_type Text/plain;
root/var/www/html;
Index index.php index.htm index.html;
#隐藏index. PHP
Location/{
if (!-e $
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.