Question on rewriting ...

Maxim Dounin mdounin at mdounin.ru
Wed Sep 5 15:11:14 MSD 2007


Hello!

On Wed, 5 Sep 2007, Rakhesh Sasidharan wrote:

>>> So I modify the config to the following:
>>> 
>>> ------8<-----------------------
>>> location / {
>>>      root        /net/store/www/data/wordpress;
>>>      index       index.php;
>>>
>>>      if (!-e $request_filename) {
>>>         rewrite ^/log/(.*)?$                    /index.php?q=$1 last;
>>> 	rewrite ^/feed/(rss|rss2|atom|rdf)$     /?feed=$1       last;
>>>         rewrite ^/feed/.+$                      /index.php      last;
>>>      }
>>> }
>>> ------8<-----------------------

[...]
> I  turned on the rewrite_log and this is what I see for a URL such as 
> http://rakhesh.com/feed/asdaa (an incorrect URL):
[...]
> Even though the rewrite seems to happen, the blog sees the "/feed/asdaa" URL. 
> Strange ...

This is what you wrote in your config. If you need redirect, not internal 
rewrite, use:

rewrite ^/feed/.+$   /index.php      redirect;

Note "redirect" flag. It's default for substitute starting with "http://", 
but must be explicitly specified for others.

Maxim Dounin





More information about the nginx mailing list