need help with rewrite
Igor Sysoev
is at rambler-co.ru
Thu Dec 11 09:51:10 MSK 2008
On Thu, Dec 11, 2008 at 11:03:23AM +0700, Glen Lumanau wrote:
> 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
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 ~ /\. { }
> 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]
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.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list