UPDATE:
1) The WP+Bedrock with multisite-url-fixer
is working and running with Caddy.
2) The part of “translation” from Apache to Caddyfile, still doesn’t work properly.
Hello,
I have tried to install the roots.io Bedrock from Composer.
completely solved
composer create-project roots/bedrock
add define('WP_ALLOW_MULTISITE', true);
into application.phpcomposer require roots/multisite-url-fixer
- after, added into application.php (this time, I have tried to use subdomain install)
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'dev.mysite.tld');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
- define Caddyfile:
(wpmu) {
rewrite {
if {path} not_match ^(\/wp)(\/wp-admin)(\/network)?
to {path} {path}/ /index.php?{query}
}
}
:80 {
redir 308 {
if {>X-Forwarded-Proto} is http
/ https://{host}{uri}
}
}
www.dev.mysite.tld {
redir https://dev.mysite.tld{uri}
}
dev.mysite.tld {
root /var/www/dev.mysite.tld/bedrock/web
import tls-cloudflare
timeouts 1h
import compact
import php72-fpm-sock
import directive-cors
import http-header
import wpmu
}
partially solved
The problem:
After choose subdomain and login
/wp/wp-admin
, the network (top menu WP admin) gives/wp-admin/network
instead/wp/wp-admin/network
path. The left admin WP menu for the main website is ok.
Note: When I use Apache, everything is ok.
The configuration that WordPress/Bedrock gaves me when I choose multi-site.
=== WORDPRESS BEDROCK SUB-DIRECTORY ===
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]
=== WORDPRESS BEDROCK SUB-DOMAIN ===
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]
What I read:
- the Caddy docs, many times… yea!
- Bedrock is incompatible with WP Multisite · Issue #328 · roots/bedrock · GitHub
- GitHub - roots/multisite-url-fixer: Fixes WordPress issues with home and site URL on multisite when using Bedrock
- Multisite support · Issue #58 · roots/bedrock · GitHub
- URL issues on multisite · Issue #250 · roots/bedrock · GitHub
- Subdomain based multisite installation frontend URLs · Issue #3 · roots/multisite-url-fixer · GitHub
Many other attempts that I have tried for wpmu snippet.
attempt 01:
(wpmu) {
rewrite {
if {path} not_match ^(\/wp)?(\/wp-admin(\/network)?)
to {path} {path}/ {path}/index.php /index.php/{query}
}
rewrite {
r ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)
to wp/${2}
}
rewrite {
if {path} not_match ^(\/wp)?(\/wp-admin(\/network)?)
r ^([_0-9a-zA-Z-]+/)?(.*\.php)$
to wp/${2}
}
}
attempt 02:
(wpmu) {
rewrite {
if {path} not_match ^(\/wp)(\/wp-admin)(\/network)?
to {path} {path}/ /index.php?{query}
}
rewrite {
if_op or
if {path} match ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)
if {path} match ^([_0-9a-zA-Z-]+/)?(.*\.php)$
to wp/{2}
}
}
partially solved
attempt 03:
Note: Works partially, not entirely.
(wpmu) {
rewrite {
if {path} not_match ^(\/wp)(\/wp-admin)(\/network)?
to {path} {path}/ /index.php?{query}
}
}
Any help will be appreciated. Thank you very much.