Forum: NGINX Rewrite rule to parse .html to .php?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joe S. (Guest)
on 2008-11-27 19:19
(Received via mailing list)
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
Marcos N. (Guest)
on 2008-11-27 23:59
(Received via mailing list)
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>
This topic is locked and can not be replied to.