Rewrite rule help


#1

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


#2

On Fri, May 29, 2009 at 11:24:36AM +0530, Anoop A. 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 ?


#3

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,


#4

On Sat, May 30, 2009 at 07:21:06AM +0530, Anoop A. 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/;
}


#5

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


#6

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 S. removed_email_address@domain.invalid