1. Caddy version (caddy version
):
caddy:latest
2. How I run Caddy:
a. System environment:
docker in debian
b. Command:
docker-compose up -d
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
# On indique quel sera le dossier racine du serveur web
root * /srv
php_fastcgi php:9000
encode gzip zstd
file_server
#Règle de réécriture
#RewriteRule ^accueil.* /solutions/index.php
rewrite /accueil.* /solutions/index.php
#RewriteRule .*f([0-9]+).html /solutions/folder.php?folid=$1 [L]
rewrite /.*f([0-9]+).html /solutions/folder.php?folid={1}
#RewriteRule .*recherche-de-formation.html /solutions/searchstage.php [L]
rewrite /.*recherche-de-formation.html /solutions/searchstage.php
#RewriteRule .*dossier-([0-9]+)-(.*).html /$2f$1.html [R=permanent,L]
rewrite /.*dossier-([0-9]+)-(.*).html /{2f}{1}.html [R=permanent,L]
#RewriteCond %{REQUEST_URI} /data/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{HTTP_HOST} ^formation.example.fr$ [NC]
#RewriteRule ^(.*)$ https://formations.example.fr%{REQUEST_URI} [R=301,L]
}
3. The problem I’m having:
Hi, I need help with rewriting rules in Caddy. I try to rewrite these rules from htaccess (lines with # are from .htaccess):
#RewriteRule ^accueil.* /solutions/index.php
rewrite /accueil.* /solutions/index.php → dunno how replace the ^
#RewriteRule .*f([0-9]+).html /solutions/folder.php?folid=$1 [L]
rewrite /.*f([0-9]+).html /solutions/folder.php?folid={1} –>dunno if it is correct
#RewriteRule .*recherche-de-formation.html /solutions/searchstage.php [L]
rewrite /.*recherche-de-formation.html /solutions/searchstage.php –>dunno if it is correct
#RewriteRule .dossier-([0-9]+)-(.).html /$2f$1.html [R=permanent,L]
rewrite /.dossier-([0-9]+)-(.).html /{2f}{1}.html –>dunno if it is correct
And for these 4 next lines, I dunno how to process
#RewriteCond %{REQUEST_URI} /data/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{HTTP_HOST} ^formation.example.fr$ [NC]
#RewriteRule ^(.*)$ https://formations.example.fr%{REQUEST_URI} [R=301,L]
Could you help me please ? i am a newby in Caddy and specially in rewriting rules.
Thx in advance,
Micka
4. Error messages and/or full log output:
no error messages
5. What I already tried:
It is indicated in number 3
6. Links to relevant resources:
and this site with this guy :