rewrite domain.com/index.php?show/name/title -> domain.com/show/name/title

Grzegorz Sienko staff at krecio.pl
Sun Dec 20 14:02:32 MSK 2009


2009/12/19 Igor Sysoev <igor at sysoev.ru>:
> On Sat, Dec 19, 2009 at 03:16:14PM +0100, Grzegorz Sienko wrote:
>
>> Hello
>>
>> I have a little problem with my rewrite and I need assist.
>>
>> It's my config:
>> --------------------------------------
>> server {
>> listen                80;
>> server_name     .domain.com;
>> root                  /home/resources/domain/db;
>> index                index.php;
>>
>> access_log      /home/log/nginx/domain.access.log main;
>> error_log          /home/log/nginx/domain.error.log error;
>>
>> location ~ \.php$ {
>> fastcgi_pass                            127.0.0.1:9001;
>> fastcgi_index                           index.php;
>> fastcgi_param  SCRIPT_FILENAME
>> /home/resources/domain/db$fastcgi_script_name;
>> include                                    fastcgi_params;
>> }
>>
>> rewrite ^/([^\.]+)/([^\.]+)$ /index.php?$1/$2 last;
>> rewrite ^/([^\.]+)/([^\.]+)/([^\.]+)$ /index.php?$1/$2/$3 last;
>>
>> }
>>
>> -----------------------------
>>
>> and it seems to work, but with one problem. I cannot load any graphics,
>> javascript file etc (anything file.extension)
>>
>> 2009/12/19 14:58:18 [error] 26753#0: *3018846 open()
>> "/home/resources/domain/db/show/anime/hidamari-sketch-x-365/599/140/img/db_script.gif"
>> failed (2: No such file or directory), client: 84.10.8.*, server: domain.com,
>> request: "GET /show/anime/hidamari-sketch-x-365/599/140//img/db_script.gif
>> HTTP/1.1", host: "domain.com", referrer: "
>> http://domain.com/show/anime/hidamari-sketch-x-365/599/140//2"
>>
>> File is here: domain.com/img/db_script.gif. And I don't know hot to fix it
>> ^^. Anyone can help me? :)
>
> The request is "domain.com/show/anime/hidamari-sketch-x-365/599/140//img/db_script.gif", but not "domain.com/img/db_script.gif".

Exactly.. in Poland we have a sentence: "the darkest place is under
the light". My webmaster correct his mistake. But.. point my with
another thing.

domain.com/manage is working ok, but.. also
domain.com////////////manage is working ok. It seems so, that nginx
transform all ////// into one / . Also in another place where I have
show/anime//594 it's make from this two // one /.

-- 
 Best Regards
Grzegorz Sienko



More information about the nginx mailing list