Rewrite all directory URLs with certain exceptions
Edho Arief
edho at myconan.net
Wed Nov 28 08:06:12 UTC 2012
On Wed, Nov 28, 2012 at 3:04 PM, Cristian Rusu <crirus at gmail.com> 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=$1
> redirect;
> }
>
> Problem is that all urls are rewritten.. how do I put some exceptions?
>
put the rewrite in a location block (e.g. inside location / { }).
More information about the nginx
mailing list