Question on rewriting ...

Rakhesh Sasidharan rakhesh at
Fri Sep 7 21:53:46 MSD 2007

Maxim Dounin wrote:

> Oops, sorry, looks like I misread your message. Your problem is that 
> WordPress get's wrong url and confused, right?
> To debug this, you should defenitely look at the place where you pass request 
> to php (e.g. "location ~ \.php$" in your nginx.conf) and (probably) your 
> WordPress configs/code.
>        location ~ \.php$ {
>            fastcgi_pass;
>            fastcgi_index  index.php;
>            fastcgi_param  SCRIPT_FILENAME 
> $document_root$fastcgi_script_name;
>            include fastcgi_params;
>        }
>    }
> The only difference in "location ~ \.php$" from the example in default nginx 
> config is SCRIPT_FILENAME (in example it's /script/$fastcgi_script_name).


> With this config, it returns rss feed for /feed/rss, atom feed for 
> /feed/atom, and rss feed again for /feed/no-such-feed. Looks like what you 
> are trying to achive.
> Versions: WordPress 2.2.2, nginx 0.6.10.

Yup, that's exactly what I want to achieve. Cool!

In my config, SCRIPT_FILENAME is set to 
/path/to/wordpress/$fastcgi_script_name. I didn't test out by changing it 
to $document_root/$fastcgi_script_name, will do once I get back to that 

Why would changing SCRIPT_FILENAME to the latter make a difference btw? My 
understanding is that $document_root points to the directive root of the 
current request, shouldn't that be /path/to/wordpress anyways? Or am I 
missing something?


 				- Rakhesh

More information about the nginx mailing list