Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to convert

RewriteEngine on
RewriteBase /generate
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/ index.php?file=$2

To nginx conf

Can anyone help me with this? Important: The htaccess was in a folder called generate Give me a suitable code that will replace the htaccess in that folder Please show me exact code , looks complicated for me:)

share|improve this question
1  
Put at least some effort into trying, or go hire a consultant. –  3molo Aug 12 '12 at 14:08
    
I converted the rest of the .htaccess . I am having problem with only this part –  Werulz Aug 12 '12 at 14:39

1 Answer 1

up vote 2 down vote accepted

At the first time, you can try something like this:

    location /generate {
        if (!-e $request_filename) {
            rewrite ^/generate/(.*)/(.*)/ /generate/index.php?file=$2;
        }
    }

but it is not recommended.

Using try_files instead:

    location /generate {
        try_files $uri $uri/ @fallback;
    }

    location @fallback {
        rewrite ^/generate/(.*)/(.*)/ /generate/index.php?file=$2 last;
    }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.