1. The problem I’m having:
I have a page called index.php. I want the user can call it by HTML extension. I already done it with the line:
uri replace .html .php
But I want the user can’t call PHP extension directly. Resuming, if the user call directly index.php, the request would be denied (404 error). But if the user call index.html, the request redirect to real index.php. I tried:
@php path *.php
respond @php 404
uri replace .html .php
But this way, all requests are denied.
2. Error messages and/or full log output:
No error message. Only… all the requests are denied
3. Caddy version:
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
4. How I installed and ran Caddy:
a. System environment:
Debian Linux 11.0
Caddy binary file
b. Command:
caddy run --config Caddyfile
d. My complete Caddy config:
:9191 {
root * /home/paulo/projeto_php
php_fastcgi 127.0.0.1:9000
encode gzip
file_server {
browse
hide .git
}
@php path *.php
respond @php 404
uri replace .html .php
try_files {path} index.html
}