I'm trying to setup a Wordpress website with multisite:
example.com
example.com/fr
With the following Caddyfile:
example.com:80 {
redir https://www.example.com{uri}
}
www.example.com:80 {
root /app/public
gzip
fastcgi / 127.0.0.1:9000 {
ext .php
split .php
index index.php
}
rewrite {
regexp ^/[_0-9a-zA-Z-]+(/wp-.*)
to {path} {path}/ {1}
}
rewrite {
regexp ^/[_0-9a-zA-Z-]+(/.*\.php)$
to {path} {path}/ {1}
}
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?_url={uri}
}
log stdout
startup /usr/sbin/php-fpm7.0 -F -O &
}
When I reach /fr/wp-admin/
, I get a 301 to /wp-admin/
.
Does anybody know how to fix that ?
This caddy config works for me. Hope this helps.
rewrite {
regexp ^(/[^/]+)?(/wp-.*)
to {2}
}
rewrite {
regexp ^(/[^/]+)?(/.*\.php)
to {2}
}
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?{query}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With