Welcome! Log In Create A New Profile

Advanced

Re: Rewrite all directory URLs with certain exceptions

November 28, 2012 07:12AM
Excellent, it worked

I have another urgent matter on a server live we just switched to

I need that links like this:
http://www.example.com/?v=JYH253CT

to be rewritten as http://www.example.com/v.php?dl=JYH253CT


Please help, server is down :(

---------------------------------------------------------------
Cristian Rusu
Web Developement & Electronic Publishing

======
Crilance.com
Crilance.blogspot.com



On Wed, Nov 28, 2012 at 10:30 AM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Wed, Nov 28, 2012 at 10:04:58AM +0200, Cristian Rusu wrote:
>
> > Hello
> >
> > I have urls like example.com/123
> > I need them rewritten to example.com/?v=123
> >
> > However, I want to skip certain directories from rewrite
> > eg.
> > example.com/status
> > example.com/admin
> >
> > right now I have this:
> >
> > if (!-e $request_filename){
> > rewrite ^/([A-Za-z0-9-]+)/?$
> http://www.example.com/v.php?dl=$1redirect;
> > }
> >
> > Problem is that all urls are rewritten.. how do I put some exceptions?
>
> I would recommend using location matching to differentiate URIs
> which should be handled differently. E.g.
>
> location / {
> # you may want to use try_files here instead
> if (...) {
> rewrite ...
> }
> ...
> }
>
> location /status {
> ...
> }
>
> location /admin {
> ...
> }
>
> See http://nginx.org/r/location for more information.
>
> --
> Maxim Dounin
> http://nginx.com/support.html
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite all directory URLs with certain exceptions

crirus November 28, 2012 03:06AM

Re: Rewrite all directory URLs with certain exceptions

Edho Arief November 28, 2012 03:08AM

Re: Rewrite all directory URLs with certain exceptions

Maxim Dounin November 28, 2012 03:32AM

Re: Rewrite all directory URLs with certain exceptions

crirus November 28, 2012 07:12AM

Re: Rewrite all directory URLs with certain exceptions

Edho Arief November 28, 2012 07:26AM

Re: Rewrite all directory URLs with certain exceptions

crirus November 28, 2012 07:34AM

Re: Rewrite all directory URLs with certain exceptions

Antonio P.P. Almeida November 28, 2012 08:00AM

Re: Rewrite all directory URLs with certain exceptions

crirus November 28, 2012 08:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 167
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready