Nginx pseudo-static writing-php Tutorial

Source: Internet
Author: User
Nginx pseudo-static writing objective: to set zonggang. php? Shuhao = 130 rewrite to read/130
In the previous Windows Server, appserv is used. in this case, it is OK:
RewriteRule ^ /? Read/([0-9] +) zonggang. php? Shuhao = $1

Now I have changed the liunx and found the conversion method on the Internet using the nginx server.

Rewrite ^ /? Read/([0-9] +) $ zonggang. php? Shuhao = $1 last;

The error 404 is returned. could you tell me if there is a problem with my writing?


Reply to discussion (solution)

To rewrite to read/130, you need to enable the path_info mode. have you done it?

To rewrite to read/130, you need to enable the path_info mode. have you done it?


Path_info mode enabled

Create a file
Show. php
Echo $ _ SERVER ['path _ info'];

Run
Http: // servername/show. php/a/B/c/d

With this method, the result/a/B/c/d is obtained.

Rewrite ^ /? Read/([0-9] +) $ zonggang. php? Shuhao = $1 last;

Rewrite ^ /? Read/([0-9] +) $ zonggang. php? Shuhao = $1 last;


Or 404. it's really strange.

I got it done, but I still wrote an error about the static rule. I found a conversion tool.
Rewrite ^ /? Read/([0-9] +)/zonggang. php? Shuhao = $1;

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.