Rewrite Rules HELP needed

G
  • 5 May '09
Is that posibble not to use it on root dir?

Just change location / to location /test

------Original Message------
From: Igor Sysoev
Sender: owner-nginx at sysoev.ru
To: nginx at sysoev.ru
ReplyTo: nginx at sysoev.ru
Subject: Re: Rewrite Rules HELP needed
Sent: May 5, 2009 5:56 PM

On Tue, May 05, 2009 at 02:51:40PM +0400, Igor Sysoev wrote:

> On Tue, May 05, 2009 at 04:58:43PM +0700, Glen Lumanau wrote:
> 
> > Can you please tell me how can I translate this rewrite so it can work with
> > nginx?
> > 
> > DirectoryIndex index.php
> > 
> > RewriteEngine on
> > 
> > RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
> > 
> > RewriteCond %{REQUEST_FILENAME} !-f
> > 
> > RewriteCond %{REQUEST_FILENAME} !-d
> > 
> > RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
> 
> root ...
> 
> location / {
>     try_files  $uri  $uri/  /index.php$uri$is_args$arg;

-     try_files  $uri  $uri/  /index.php$uri$is_args$arg;
+     try_files  $uri  $uri/  /index.php$uri$is_args$args;

>     index index.php;
> }
> 
> locaiton ~ \.php($|/) {
>     ...
> }
> 
> location /images { }
> location /css { }
> location /js { }
> location = /robots.txt { }
> location = /favicon.ico { }
> 
> 
> -- 
> Igor Sysoev
> http://sysoev.ru/en/

-- 
Igor Sysoev
http://sysoev.ru/en/

Best Regards,

Glen Lumanau
-
Sent from my BlackBerry?
I
  • 5 May '09
On Tue, May 05, 2009 at 11:04:59AM +0000, Glen Lumanau wrote:

> Is that posibble not to use it on root dir?
> 
> Just change location / to location /test

Yes, you may use any location including given by regex.

> ------Original Message------
> From: Igor Sysoev
> Sender: owner-nginx at sysoev.ru
> To: nginx at sysoev.ru
> ReplyTo: nginx at sysoev.ru
> Subject: Re: Rewrite Rules HELP needed
> Sent: May 5, 2009 5:56 PM
> 
> On Tue, May 05, 2009 at 02:51:40PM +0400, Igor Sysoev wrote:
> 
> > On Tue, May 05, 2009 at 04:58:43PM +0700, Glen Lumanau wrote:
> > 
> > > Can you please tell me how can I translate this rewrite so it can work with
> > > nginx?
> > > 
> > > DirectoryIndex index.php
> > > 
> > > RewriteEngine on
> > > 
> > > RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
> > > 
> > > RewriteCond %{REQUEST_FILENAME} !-f
> > > 
> > > RewriteCond %{REQUEST_FILENAME} !-d
> > > 
> > > RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
> > 
> > root ...
> > 
> > location / {
> >     try_files  $uri  $uri/  /index.php$uri$is_args$arg;
> 
> -     try_files  $uri  $uri/  /index.php$uri$is_args$arg;
> +     try_files  $uri  $uri/  /index.php$uri$is_args$args;
> 
> >     index index.php;
> > }
> > 
> > locaiton ~ \.php($|/) {
> >     ...
> > }
> > 
> > location /images { }
> > location /css { }
> > location /js { }
> > location = /robots.txt { }
> > location = /favicon.ico { }
> > 
> > 
> > -- 
> > Igor Sysoev
> > http://sysoev.ru/en/
> 
> -- 
> Igor Sysoev
> http://sysoev.ru/en/
> 
> 
> 
> Best Regards,
> 
> Glen Lumanau
> -
> Sent from my BlackBerry?

-- 
Igor Sysoev
http://sysoev.ru/en/