p4u1
1a6b11c95b
Some checks failed
continuous-integration/drone/push Build is failing
With this commit multisite now also works with subpaths instead of subdomains. It also simpified the multisite deployment in generall by adding a new MULTISITE environment variable. Depending on its value WORDPRESS_CONFIG_EXTRA gets set in the entrypoint. And the correct .htaccess gets deployed. Closes #34 I am still new to coopcloud and welcome feedback on my approach. The second commit is not required for #34 so I can remove it again. Reviewed-on: #35 Co-authored-by: p4u1 <p4u1_f4u1@riseup.net> Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
58 lines
1.6 KiB
Cheetah
58 lines
1.6 KiB
Cheetah
{{ if eq (env "MULTISITE") "" -}}
|
|
# BEGIN WordPress
|
|
|
|
RewriteEngine On
|
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
RewriteBase /
|
|
RewriteRule ^index\.php$ - [L]
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule . /index.php [L]
|
|
|
|
# END WordPress
|
|
{{- end -}}
|
|
|
|
{{- if eq (env "MULTISITE") "subfolder" -}}
|
|
# BEGIN WordPress Multisite
|
|
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
|
|
|
RewriteEngine On
|
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
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).*) $2 [L]
|
|
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
|
RewriteRule . index.php [L]
|
|
|
|
# END WordPress Multisite
|
|
{{- end -}}
|
|
|
|
{{- if eq (env "MULTISITE") "subdomain" -}}
|
|
# BEGIN WordPress Multisite
|
|
# Using subdomain network type: https://wordpress.org/documentation/article/htaccess/#multisite
|
|
|
|
RewriteEngine On
|
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
|
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).*) $1 [L]
|
|
RewriteRule ^(.*\.php)$ $1 [L]
|
|
RewriteRule . index.php [L]
|
|
|
|
# END WordPress Multisite
|
|
{{- end }}
|