1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
a. System environment:
Ubuntu 20.04
b. Command:
caddy start
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
GNU nano 4.8 Caddyfile Modified
technicalpenguins.com {
root * /srv/technicalpenguins.com
php_fastcgi localhost:9000
file_server
}
http://wordle.com {
redir https://www.nytimes.com/games/wordle/index.html
}
www.joanconcilio.com, joanconcilio.com {
root * /srv/joanconcilio.com
php_fastcgi localhost:9000
file_server
}
www.unschoolrules.com, unschoolrules.com {
root * /srv/unschoolrules.com
php_fastcgi localhost:9000
file_server
}
3. The problem I’m having:
I want to remove dates from some URIs before passing them to the PHP handler for unschoolrules.com. There are URLs in the wild that look like https://unschoolrules.com/2004/04/rest-of-url and https://unschoolrules.com/2004/rest-of-url; they need to redirect to https://unschoolrules.com/rest-of-url. (This is a pretty standard WordPress URL change.)
4. Error messages and/or full log output:
Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.
5. What I already tried:
I cannot figure out the way to do it. I’ve tried handle_path
but I don’t think that’s the right approach (it just continued to 404 trying to find the original URL). I’m not sure if I need to completely recreate the server instructions inside each matcher, or if there’s a way to just strip URI prefix. I( think strip_prefix
will enter into it somewhere, but I’m unclear where.)