Rewrite rule to parse .html to .php?


#1

Without editing:

            location ~ \.php$ {
                    include conf/fastcgi_params;
                    fastcgi_pass unix:/home/nginx/phpcgi/USERNAME;
                    fastcgi_index index.php;
            }

Is there a way to add in nginx to send any *.html requests to as *.php
to
Nginx?

Without having to add another directive like:

            location ~ \.html$ {
                    include conf/fastcgi_params;
                    fastcgi_pass unix:/home/nginx/phpcgi/USERNAME;
                    fastcgi_index index.php;
            }

Just to do what I want.

I am developing a backend for Nginx for in a shared-hosting environment,
just I don’t want to give customers access to edit this part of the
config,
so looking for a rewrite rule if possible to send *.html to *.php , or
anything in that concept.

Thanks


#2

The rewrite rule is build with regular expression, so you can do this:
location ~ .(php|html?)$ {
include conf/fastcgi_params;
fastcgi_pass unix:/home/nginx/phpcgi/USERNAME;
fastcgi_index index.php index.htm index.html;
}

Marcos N.
+55 44 3263-8132
+55 44 9918-8488

2008/11/27 Joe S. removed_email_address@domain.invalid