Rewrite Rules from apache

Hi Everyone,

i try to convert some rules from apache htaccess to nginx.

This is my htaccess Rule:

RewriteCond %{DOCUMENT_ROOT}/$3 -f
RewriteRule ^(.?)/(.?)/(.*)$ /$3

I tried these options but it seems not working:

if (-f $document_root/$3){
set $rule_0 1$rule_0;
if ($rule_0 = “1”){
rewrite ^/(.?)/(.?)/(.*)$ /$3;

Anyone have a good idea?



July 7 2016 10:19 PM, “Daniel” [email protected] wrote:


nginx mailing list
[email protected]

how about

location ^/(.?)/(.?)/(.)/(.)$ {
try_files /$3 $uri =404;

Same issue.

All images CSS Files and so on are not loaded :frowning:

On Thu, Jul 07, 2016 at 06:49:21PM +0200, Daniel wrote:

Hi there,

This is my htaccess Rule:

RewriteCond %{DOCUMENT_ROOT}/$3 -f
RewriteRule ^(.?)/(.?)/(.*)$ /$3

I suspect that some previous part of the htaccess file has a regex which
sets $3. What is that?

Or, alternatively:

What http request do you make?

What response do you want? As in, what file on your filesystem do you
want nginx to return, for this request?


Francis D. [email protected]

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

| Privacy Policy | Terms of Service