欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

一个关于Apache Rewrite从FPM转到FastCGI的问题

程序员文章站 2024-04-04 18:25:47
...
目的是想要将PC版http://test.com/front/index这样的Url
在手机版上显示为http://test.com/m/front/index
实际的链接应该是http://test.com/front/index?mode=m

现在我在测试环境上的Rewrite是这么写的:

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]

一切都可以正常访问,而到了服务器上则出现了问题

本地测试环境是XAMPP(据别人说是FPM),服务器上的是Apache FastCGI
想要请教一下应该如何改写Rewrite规则才能正常解析,谢谢?

回复内容:

目的是想要将PC版http://test.com/front/index这样的Url
在手机版上显示为http://test.com/m/front/index
实际的链接应该是http://test.com/front/index?mode=m

现在我在测试环境上的Rewrite是这么写的:

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]

一切都可以正常访问,而到了服务器上则出现了问题

本地测试环境是XAMPP(据别人说是FPM),服务器上的是Apache FastCGI
想要请教一下应该如何改写Rewrite规则才能正常解析,谢谢?