Rewrite translation apache to nginx

Hello,

I have always difficulty with rewrite translating apache to nginx.

RewriteEngine On # # Full path to your site # RewriteBase / # Rename Photo Names RewriteRule ^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)([_0-9]*?)\.(.*)$ file/pic/photo/$1/$2/$3$5.$6 # # Rules # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.php?do=/$1 # Image Access Protection RewriteRule ^file/pic/photo/(.*)\.(.*)$ static/image.php?file=$1&ext=$2

It is my translation

location / {
rewrite
^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)-(.?)([_0-9]?).(.*)$
file/pic/photo/$1/$2/$3$5.$6 break;

if (!-f $request_filename ) {
break;
}

if (!-d $request_filename) {
break;
}

rewrite ^(.*)$ index.php?do=/$1
}

How to convert it properly.

Thanks
Tseveen.

2011/11/25 Цэвээндорж [email protected]:

    RewriteBase /
    # Rename Photo Names
    RewriteRule

^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)-(.?)([_0-9]?).(.*)$
file/pic/photo/$1/$2/$3$5.$6

rewrite
^/file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)-(.?)([_0-9]?).(.*)$
/file/pic/photo/$1/$2/$3$5.$6;

    #
    #  Rules
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) index.php?do=/$1

try_files $uri $uri/ /index.php?do=$uri;

    # Image Access Protection
    RewriteRule ^file/pic/photo/(.*)\.(.*)$

static/image.php?file=$1&ext=$2

rewrite ^/file/pic/photo/(.).(.)$ /static/image.php?file=$1&ext=$2

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs