Forum: NGINX Rewrite rule help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2009-05-29 08:03
(Received via mailing list)
Hello,

It would be great if someone can help me port the following apache
rewrite
rules to nginx

=====================
RewriteRule @^/paOS(.+)@i /?/paos$1 [L]
RewriteRule ^SOap(.+) /?/paos$1 [L]
RewriteRule ^paos(.+) /?/paos$1 [L]

=====================

Thanks in advance
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-29 10:05
(Received via mailing list)
On Fri, May 29, 2009 at 11:24:36AM +0530, Anoop Alias wrote:

> =====================
I did not find @..@i syntax in mod_rewrite documntation, but it seems
it should case insensitive regex.

What should be done with /?/paos.... then ?
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2009-05-30 04:00
(Received via mailing list)
Thank you Igor,

Sorry , that was the wrong apache rewrite rules

The correct one is
==================
RewriteRule ^(/paos|/soap)(.+) / [NC,L,PT]
==================

This is the one that needs to be ported to nginx fomat



Thanks again,
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-05-30 08:19
(Received via mailing list)
On Sat, May 30, 2009 at 07:21:06AM +0530, Anoop Alias wrote:

> Thank you Igor,
>
> Sorry , that was the wrong apache rewrite rules
>
> The correct one is
> ==================
> RewriteRule ^(/paos|/soap)(.+) / [NC,L,PT]
> ==================
>
> This is the one that needs to be ported to nginx fomat

location /paos/ {
    proxy_pass  http://backend/;
}

location /soap/ {
    proxy_pass  http://backend/;
}
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2009-06-02 07:03
(Received via mailing list)
Thanks Igor,

But that does not work :(.

from what i could find out; i think the URL parsing is handled by the
index.php file itself. so every request to a non existing content must
pass
to the index.php file without having any change in the URL. I guess that
is
why the apache pass through directive is there (PT). If we delete the PT
the
website stops functioning!


I found the following rules working correctly for lightppd

======================
           "^/paOScore(.+)$" => "/?/paoscore/$1",
                "^/paOS(.+)$" => "/?/paos$1",
                "^/SOap(.+)$" => "/?/paos$1",
======================

On similar lines the following nginx rules were created
======================
        rewrite ^/paOScore(.*)$         /?/paoscore/$1  last;

        rewrite ^/paOS(.*)$             /?/paos$1       last;
        rewrite ^/SOap(.*)$             /?/paos$1       last;
========================

Which works but gets the page in a redirect loop if an https page is
requested.it works perfect for the http page

The URL's are all in the format

http://www.domain.com/paos-14-71-1h-49-en.html

http://www.domain.com/paoscore/10-49-en.html


The content is dynamically pulled from a database according to the URL
input
;as far as i can see ;this is how it works

there is code snippets in the index.php which says
if ( $_SERVER[ 'REQUEST_URI' ]...
....

etc

any help is much appreciated

Thanks ,
Anoop


2009/5/30 Igor Sysoev <is@rambler-co.ru>
09f5f6b58be8300f6edcd6b1641a3574?d=identicon&s=25 Anoop Alias (Guest)
on 2009-06-02 07:04
(Received via mailing list)
In short as far as i can tell, what is required is a method to pass all
request to any non existing file to the index.php keeping the
REQUEST_URI
intact.
Now i maybe wrong also ; but i couldnt find anything in apache or
lighttpd
that says  replacement string has something passed as an argument


Thanks,
Anoop
This topic is locked and can not be replied to.