Version v2.4.6
I have a file structure that contains a login.php
at the server root level and another one in a subdirectory. I would like Caddy to default to their respective login.php
.
Using the try_files
directive I can get it working for the root directory and partially for the subdirectory : when requesting server-name/subdir/
it finds the proper subdir/login.php
but not its associated css file. See file structure below.
Caddyfile:
:80 {
root * /var/www/pirard4
file_server
try_files {path} /login.php
try_files m/{path} /m/login.php
php_fastcgi unix//var/run/php/php7.4-fpm.sock
log {
output file /var/log/caddy/pirard.log
}
}
My simplified server tree :
βββ login.php
βββ other-files.php
βββ m
β βββ css
β β βββ 03302049-mobile.css
β βββ login.php
β βββ other-files.php
Edit : log entry when requesting http://server-name/m/
$ jq '.common_log' pirard.log; echo '' > pirard.log
"192.168.0.92 - - [31/Mar/2022:19:22:13 +0200] \"GET /m/ HTTP/1.1\" 200 1196"
"192.168.0.92 - - [31/Mar/2022:19:22:13 +0200] \"GET /m/css/03302049-mobile.css HTTP/1.1\" 200 1196"