Need help with rewrite

Hi

Can someone help me in translating this rewrite into nginx?

RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]

##optional - see notes##

RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*) index.php

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]

RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]

RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})

RewriteRule ^(.*)$ index.php [F,L]

Appreciate your help

On Thu, Dec 11, 2008 at 11:03:23AM +0700, Glen L. wrote:

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*) index.php

As I understand these are Joomla rewrite rules. If you have no any
dot-files,
as .htaccess, then the regex part “/[^.]*)$” means effectively anything,
i.e.
“location /”.

The RIGHT nginx configuration is

root  /path/to/files;

location / {
     log_not_found  off;
     error_page  404 = @joomla;
}

location @joomla {
     fastcgi_pass   ...;
     fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
     ... other fastcgi_params

}

If you have also other php files, then add

location ~ \.php$ {
     fastcgi_pass   ...;
     fastcgi_param  SCRIPT_FILENAME  /path/to/$fastcgi_script_name;
     ... other fastcgi_params
}

If you have static dot-files, then add:

location ~ /\. { }
RewriteRule ^(.*)$ index.php [F,L]

I have no idea WHY Joomla developers think that Joomla parameters
validation should be placed on web server side. Please, send them
feedback,
that these rules should be implemented inside Joomla: this is not web
server job.

On Thu, Dec 11, 2008 at 09:51:10AM +0300, Igor S. wrote:

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule (.*) index.php

As I understand these are Joomla rewrite rules. If you have no any dot-files,
as .htaccess, then the regex part “/[^.]*)$” means effectively anything, i.e.
“location /”.

Sorry, “/[^.]*)$” means files without dots at all. So the configuration
is
the same, expect, thay you should handle images in some static location:

  location ~ \.(gif|jpg|png)$ { }

Thank you so much Igor… It’s works very nice :slight_smile:

Regards,

Glen L.