Home > Backend Development > PHP Tutorial > A question about Apache Rewrite switching from FPM to FastCGI

A question about Apache Rewrite switching from FPM to FastCGI

WBOY
Release: 2016-08-04 09:21:06
Original
1439 people have browsed it

The purpose is to display the Url
like http://test.com/front/index on the PC version as http://test.com/m/front/index on the mobile version
The actual link should be http: //test.com/front/index?mode=m

Now I write Rewrite in the test environment like this:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^m/?(.*)/?$ index.php/$1/?mode=m [QSA,PT,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

Everything can be accessed normally , and there was a problem on the server

The local test environment is XAMPP (according to others, it is FPM), and the server is Apache FastCGI
I would like to ask how to rewrite the Rewrite rules to enable normal parsing, thank you?

Reply content:

The purpose is to display the Url
like http://test.com/front/index on the PC version as http://test.com/m/front/index on the mobile version
The actual link should be http: //test.com/front/index?mode=m

Now I write Rewrite in the test environment like this:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^m/?(.*)/?$ index.php/$1/?mode=m [QSA,PT,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

Everything can be accessed normally , and there was a problem on the server

The local test environment is XAMPP (according to others, it is FPM), and the server is Apache FastCGI
I would like to ask how to rewrite the Rewrite rules so that it can be parsed normally, thank you?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template