Welcome! Log In Create A New Profile

Advanced

Re: Converting Rewrites to Nginx

Miguel Clara
March 18, 2014 09:52AM
location / {
try_files $uri $uri/ /index.php?url=$1 last;
}


Maybe what you want here is:
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /index.php/$1;
}




On Tue, Mar 18, 2014 at 12:05 PM, parkerj <nginx-forum@nginx.us> wrote:

> I have been trying to convert the following htaccess rules to nginx with no
> luck.
>
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-l
> RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
>
> I've tried:
>
> location / {
> if (!-e $request_filename){
> rewrite ^(.+)$ /index.php?url=$1 last;
> }
> }
>
> and I've also tried:
>
> location / {
> try_files $uri $uri/ /index.php?url=$1 last;
> }
>
> None seem to work. Any help with this is greatly appreciated.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,248446,248446#msg-248446
>
> _______________________________________________
> 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

Converting Rewrites to Nginx

parkerj March 18, 2014 08:05AM

Re: Converting Rewrites to Nginx

Miguel Clara March 18, 2014 09:52AM

Re: Converting Rewrites to Nginx

parkerj March 18, 2014 10:54AM

Re: Converting Rewrites to Nginx

parkerj March 18, 2014 03:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 304
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready