Dear people,
I'm stuck with a third party designed website that needs to run for a brief time on nginx (to improve the speed). There is a new site in development but for the time being it has to work. The current Apache rewrite config below:
---
RewriteEngine on
RewriteRule ^([A-Z]{2,3})/rss/(.*)/$ index.php?changelang=$1&p=rss&rsssub=$2 [L]
RewriteRule ^rss/(.*)/$ index.php?p=rss&rsssub=$1 [L]
#check if file exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/scripts/(.*)$ scripts/$2 [NC,L]
RewriteRule ^(.*)/cats/(.*)$ cats/$2 [NC,L]
RewriteRule ^(.*)/cms/(.*)$ cms/$2 [NC,L]
RewriteRule ^(.*)/images/(.*)$ images/$2 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^images/(.*)$ images/cp/geen_foto\.gif [NC,L]
RewriteRule ^(.*)/css/(.*)$ css/$2 [NC,L]
RewriteRule ^([A-Z]{2,3})/index\.php?(.*)$ index.php?changelang=$1&pid=$2 [QSA,L]
RewriteRule ^index\.php?(.*)$ index.php?pid=$1 [QSA,L]
RewriteRule ^([A-Z]{2,3})/$ index.php?changelang=$1 [L]
RewriteRule ^([A-Z]{2,3})/(.*)\.html$ index.php?changelang=$1&userurl=$2\.html [L]
RewriteRule ^(.*)\.html$ index.php?userurl=$1\.html [L]
RewriteRule ^([A-Z]{2,3})/(.*)/$ index.php?changelang=$1&userurl=$2 [L]
RewriteRule ^(.*)/$ index.php?userurl=$1 [L]
RewriteRule ^(.*)/(.*)\.html$ index.php [L]
---
When I convert the rules I get:
----
location / {
rewrite "^/([A-Z]{2,3})/rss/(.*)/$" /index.php?changelang=$1&p=rss&rsssub=$2 break;
if (!-e $request_filename){
rewrite ^/(.*)/scripts/(.*)$ /scripts/$2 break;
}
rewrite ^/(.*)/cats/(.*)$ /cats/$2 break;
rewrite ^/(.*)/cms/(.*)$ /cms/$2 break;
rewrite ^/(.*)/images/(.*)$ /images/$2 break;
if (!-e $request_filename){
rewrite ^/images/(.*)$ /images/cp/geen_foto\.gif break;
}
rewrite ^/(.*)/css/(.*)$ /css/$2 break;
rewrite "^/([A-Z]{2,3})/index\.php?(.*)$" /index.php?changelang=$1&pid=$2 break;
rewrite "^/([A-Z]{2,3})/$" /index.php?changelang=$1 break;
rewrite "^/([A-Z]{2,3})/(.*)\.html$" /index.php?changelang=$1&userurl=$2\.html break;
rewrite ^/(.*)\.html$ /index.php?userurl=$1\.html break;
rewrite "^/([A-Z]{2,3})/(.*)/$" /index.php?changelang=$1&userurl=$2 break;
rewrite ^/(.*)/$ /index.php?userurl=$1 break;
rewrite ^/(.*)/(.*)\.html$ /index.php break;
}
location /rss {
rewrite ^/rss/(.*)/$ /index.php?p=rss&rsssub=$1 break;
}
location /index {
rewrite ^/index\.php?(.*)$ /index.php?pid=$1 break;
}
----
This results in non working rewrite rules and the PHP files are just being downloaded. I know If statements are not done and try_files must be used but I miss the expertise to correct this errors. Is there someone who can help me out with this?