Rewrite rules for "random" subfolders

Muffel2k nginx-forum at nginx.us
Fri Aug 14 18:33:35 UTC 2015


Unfortunately not -.- here is a small summary of my vhost

server {

        location / {
                index index.php index.html index.htm;
                try_files $uri $uri/ @rewrites;
                rewrite ^(.*)/(.*)-single\.php $1/single.php?id=$2 last;
        }



        location @rewrites {
                rewrite ^ /index.php last;
        }


}

I emptied my cache and restarted nginx as well .... no success 

ryd994 Wrote:
-------------------------------------------------------
> Hi,
> 
> Does this work?
> rewrite ^(.*)/(.*)-single\.php $1/single. php?id=$2 last;
> 
> Not tested, so anything could happen.
> 
> On Fri, Aug 14, 2015, 18:22 Muffel2k <nginx-forum at nginx.us> wrote:
> 
> > Hey,
> >
> > I would like to migrate my page from a webhoster to my own vServer
> running
> > Nginx. So far I got everything up and running EXCEPT these stupid
> .htaccess
> > file. Let me explain:
> >
> > My site contains several galleries with slideshows. When you are
> watching
> > one of those you click a link which looks like this
> >
> > "DOMAIN/galleries/album-set/album-2/DSC01154-single.php"
> >
> > (only DOMAIN/galleries and -single.php) are fixed. The rest can
> vary. Those
> > links are generated by Lightroom and a plugin and during this
> process a
> > .htaccess file will be copied into each folder. The content looks
> like
> > this:
> >
> > <IfModule mod_rewrite.c>
> > RewriteEngine On
> > RewriteRule ^(.*)-single.*php$ single.php?id=$1 [L]
> > </IfModule>
> >
> > This makes my link
> > DOMAIN/galleries/album-set/album-2/DSC01154-single.php
> > point to this
> > DOMAIN/galleries/album-set/album-2/single.php?id=DSC01154
> >
> > as you can see, the "DSC01154" will be passed through. I am trying
> for
> > several days to create a rewrite rule for Nginx doing the same
> without
> > killing my page.
> >
> > Does anyone knows a solution for this?
> >
> > Posted at Nginx Forum:
> > http://forum.nginx.org/read.php?2,261008,261008#msg-261008
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261008,261024#msg-261024



More information about the nginx mailing list