How can I rewrite .php files properly?
Matthias Fechner
idefix at fechner.net
Mon Jun 19 20:10:19 UTC 2017
Am 19.06.2017 um 21:32 schrieb Joergi:
> I am running a MediaWiki installation and I am using this block of rules to
> rewrite requests to MediaWiki:
>
>
> location ~ \.php {
> root /home/$username/www/;
> index index.php index.html;
> try_files /dummy/$uri @php;
> }
>
I use the following configuration snippet:
location / {
rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
}
location ^~ /maintenance/ {
return 403;
}
location ~ \.php?$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php-handler;
fastcgi_param HTTPS on;
}
Gruß
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
More information about the nginx
mailing list