The blog about containerisation, virtual machines and useful shell snippets and findings

Opencart nginx rewrite rules

rewrite ^/sitemap.xml$ /index.php?route=feed/google_sitemap last;
    rewrite ^/googlebase.xml$ /index.php?route=feed/google_base last;
    rewrite ^/download/(.*) /index.php?route=error/not_found last;
    if (!-f $request_filename) {
        set $rule_3 1$rule_3;
    }
    if (!-d $request_filename) {
        set $rule_3 2$rule_3;
    }
    if ($uri !~ ".*.(ico|gif|jpg|jpeg|png|js|css)") {
        set $rule_3 3$rule_3;
    }
    if ($rule_3 = "321") {
        rewrite ^/([^?]*) /index.php?_route_=$1 last;
    }