Roots Discourse

Hiding the /wp subdirectory

Just wanted to document that I got bedrock working without the /wp subdirectory using the following nginx rules:

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

Without the first line, I was having problems logging in even though the urls seemed to rewrite properly.

5 Likes

I actually prefer to keep the wp directory, it’s one more layer that may prevent some bots and malicious users from finding the login area.

Thanks for posting though, always good to have the options/reference

Thanks, thats super useful. Have you tried it with multisite?

Now if I could only figure out how to rewrite the admin panel from /wp-admin to /admin

I posted the nginx rules that I have been using successfully in this thread.

http://discourse.roots.io/t/recommended-subdomain-multisite-nginx-vhost-configuration-with-new-web-layout/1429/10?u=etc

Thanks! I’ll give that a shot. Just curious if you’re using sub-domain or sub-directory, and are you using domain mapping as well?

Sub-domain, domain mapping.

Wanted to update that these rules and a subdomain, domain mapping setup work with hhvm.

One roadblock that I ran into with hhvm - New Relic doesn’t support it yet, so if you rely on it for profiling, there is no official support. There an open source extension which I haven’t yet tried: https://github.com/chregu/hhvm-newrelic-ext