Rewrite issue

Clint Priest cpriest at
Mon Sep 29 21:35:23 MSD 2008

I've got an odd configuration issue I cannot solve, using this config:

server {
    listen             80;
    access_log        logs/leadgen.access         main;
    error_log        logs/leadgen.error;
    root            /opt/leadgen;
    index            index.php;
    # If its referencing a resource, check other locations
    location /res {
        rewrite ^/res/(.+)$                            
/code/script.CustomResource.php?File=$1                last;
    location / {
        rewrite ^/Blocked$                             
/code/Scripts/Blocked.php                            last;

    location ~* \.php {
        include fastcgi;

Going to the following url: /res/xyz.gif properly gets rewritten to 
/code/script.CustomResource.php?File=xyz.gif and the php processor 
properly handles the php file.

But going to this url: /Blocked properly gets rewritten to 
/code/Scripts/Blocked.php but the php processer never handles the php 
file, nginx returns the .php source code.

Any idea what I'm doing wrong?



More information about the nginx mailing list