Php 将htaccess转换为Nginx
各位用户好 我在网上找到了一本关于PHP路由的不错的教程。我的问题是,我正在服务器上使用Nginx。我测试了在互联网上找到的一些解决方案,但没有任何效果:( 对于像Laravel这样的框架,我正在使用:Php 将htaccess转换为Nginx,php,.htaccess,nginx,Php,.htaccess,Nginx,各位用户好 我在网上找到了一本关于PHP路由的不错的教程。我的问题是,我正在服务器上使用Nginx。我测试了在互联网上找到的一些解决方案,但没有任何效果:( 对于像Laravel这样的框架,我正在使用: location / { try_files $uri $uri/ /index.php?$query_string; } 这是教程中的.htaccess: DirectoryIndex index.php RewriteEngine on RewriteBase /MYBASEPAT
location / {
try_files $uri $uri/ /index.php?$query_string;
}
这是教程中的.htaccess:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /MYBASEPATH
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA]
这应该起作用:
location / {
try_files $uri $uri/ /index.php?$query_string;
rewrite ^/(.*)$ /index.php/$1;
}
这应该起作用:
location / {
try_files $uri $uri/ /index.php?$query_string;
rewrite ^/(.*)$ /index.php/$1;
}