1

I'm trying to move an existing Bedrock based multisite instance to nginx and am having difficulty getting a set of nginx rules to mimic the original .htaccess. Bedrock places the crux of the files in a wp/ subdirectory, but the urls still need to be accessible from the root domain.

The .htaccess is here as follows:

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]

I need these at least as nginx conf rules or preferably nginx vhost rules.

2

Ok some wise guy deleted my last post.

The answer, which the above member (@etc) gave to me on another forum, and is working quite fine, is as follows:

# Rewrites for Bedrock Multi-Site Subdomain Setup
rewrite /wp-admin$ $scheme://$host$uri/ last;
rewrite ^/(wp-.*.php)$ /wp/$1 last;
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

He revised his answer but did not post it back here. I simply wanted to update it as I ran across this thread as well.

0
rewrite /wp-admin$ $scheme://$host$uri/ last;
rewrite ^/(wp-.*.php)$ /wp/$1 last;
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

These are the equivalent rewrite rules that you need. Note, when you use this rewrite, you no longer have to set the site_url as /wp

I need to finish up some testing but will update here with the results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.