Convert rewrite from apache to nginx
March 20, 2013 08:57AM

I have this .htaccess file in my apache configuration:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]

RewriteRule ^(.*)/(.*)_image.jpg [L]
RewriteRule ^(.*)/(.*)_(.*).jpg [L]

Can you please convert this rules to nginx? Thanks.

Edited 1 time(s). Last edit at 03/20/2013 08:58AM by asdfg.
Re: Convert rewrite from apache to nginx
May 06, 2013 06:56AM
location / {
try_files $uri $uri/ =404;

location ~ ^/[^/]+/[^_]+_.*\.jpg$ {
return 301 /page.html;
# use "try_files" instead of "return 301" if page.html is a static page
# try_files /page.html $uri;

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready