简体   繁体   中英

PHP htaccess to nginx

htaccess to nginx but getting errors

I have tried online tools also but no help http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ and http://winginx.com/htaccess

Here is what I am doing

.htaccess

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

My nginx is

(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 .

I have already refered to this: convert htaccess to nginx , but no help so far.

@Harinder: There must be some RewriteCond based on which you're applying this RewiteRule

The reason why i am saying this is that, according to your RewriteRule

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

whatever that comes as a request, you are sending it to 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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