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

Igor Sysoev igor at sysoev.ru
Sat Dec 19 23:07:36 MSK 2009


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".


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list