NGNIX code

Tagged: ,

This topic contains 5 replies, has 3 voices, and was last updated by  ClassiBase 2 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #572 Reply

    Elite Tan
    Participant

    Hi Support,
    I’m running on nginx and not on apache, please let me know
    what’s the code for nginx to convert below, I tried several nginx code
    for below all don’t work, please advice.
    ———
    AddDefaultCharset UTF-8
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase //

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    # Main URL rewriting.
    RewriteRule ^(.*)$ index.php?$1 [L,QSA]
    </IfModule>

    #578 Reply

    ClassiBase
    Keymaster

    We have not tried it on Nginx, but searching google for the solution gives some suggestions.

    Try this:

    location / {
            index index.html index.php;
            # URLs that don't exist go to WordPress /index.php PHP FastCGI
            if (!-e $request_filename) {
                rewrite ^.* /index.php break;
                fastcgi_pass 127.0.0.1:9001;
            }

    it is solution for wordpress from http://stackoverflow.com/a/9341066
    Classibase .htaccess file works similar to wordpress so this should work.

    #590 Reply

    ClassiBase
    Keymaster

    if it didn’t work try this

    location / {
      if (!-e $request_filename){
        rewrite ^(.*)$ /index.php?$1 break;
      }
    }

    generated from online conversion tool: http://winginx.com/htaccess

    Also try this which is worked for some using ClassiBase:

    location / {
      if (!-e $request_filename){
        rewrite ^(.*)$ /index.php?$1 break;
      }
    }
    #2150 Reply

    jammesflorence
    Participant

    hello,

    This code does not work for me.

    I installed the script in a folder named “ads”.

    How to run your script with Nginx?

    thank you

    #2159 Reply

    jammesflorence
    Participant

    Can you help @ClassiBase, it is you the author of this script?

    You know your code, right?

    #2163 Reply

    ClassiBase
    Keymaster

    Can you please try following setting for nginx, if you installed it to “ads” folder then instead of just / use /ads/

    location /ads/ {
    if (!-e $request_filename){
    rewrite ^/ads/(.*)$ /ads/index.php?$1 break;
    }
    }

    Please let us know if it worked.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: NGNIX code
Your information: