繁体   English   中英

我需要从htaccess到NGINX的URL重写转换

[英]I need url rewriting conversion from htaccess to NGINX

我尝试转换此.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

到NGINX

location / {
    try_files $uri $uri/  /index.php?_route=$uri;
}

但不起作用

如果工作,您会在http://test.bktvnews.com/data/menu/footer http://test.bktvnews.com/data/上看到json文件

您可以使用此在线工具进行转换。 http://winginx.com/cn/htaccess

这是您对Nginx的.htaccess

# nginx configuration
location / {
    if (!-e $request_filename){
        rewrite ^/(.)\?$ /index.php?route=$1 break;
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM