简体   繁体   English

PHP htaccess到nginx

[英]PHP htaccess to nginx

htaccess to nginx but getting errors htaccess到nginx,但出现错误

I have tried online tools also but no help http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ and http://winginx.com/htaccess 我也尝试过在线工具,但没有帮助http://www.anilcetin.com/convert-apache-htaccess-to-nginx/http://winginx.com/htaccess

Here is what I am doing 这是我在做什么

.htaccess .htaccess

RewriteRule ^(.*)$ /all_drivers.php?id=$1 [QSA]

My nginx is 我的nginx是

(Try 1) *** rewrite ^/(.*)$ /all_drivers.php?id=$1 ;
(Try 2) *** rewrite /(.*) /all_drivers.php?id=$1 ;

This way page loading is fine but static files don't load ... like /css.css or /js.js and index.php is also not loading its just showing all_drivers.php blank file . 这样页面加载很好,但是静态文件不会加载... ... /css.css或/js.js,index.php也不会加载只显示all_drivers.php空白文件。

I have already refered to this: convert htaccess to nginx , but no help so far. 我已经提到过: 将htaccess转换为nginx ,但到目前为止没有帮助。

@Harinder: There must be some RewriteCond based on which you're applying this RewiteRule @Harinder:应用此RewiteRule时必须有一些RewriteCond

The reason why i am saying this is that, according to your RewriteRule 我这么说的原因是,根据您的RewriteRule

RewriteRule ^(.*)$ /all_drivers.php?id=$1 [QSA]

whatever that comes as a request, you are sending it to all_drivers.php . 无论请求是什么,您都将其发送到all_drivers.php

And if this is the desired rule, then all the request, no matter what will be send to this file only. 如果这是所需的规则,那么所有请求,无论将什么都发送到该文件。

Also it will be nice if you give us the complete .htaccess code segment that you want to be translated. 如果您将要翻译的完整.htaccess代码段提供给我们,那也很好。

And please check if you have configured php execution block correctly with all the required fastcgi directives as this blank php's output comes in the case if you have not passed SCRIPT_FILENAME fastcgi directive. 并请检查您是否已使用所有必需的fastcgi指令正确配置了php执行块,因为如果未传递SCRIPT_FILENAME fastcgi指令,则会出现空白的php输出。

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

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