3

I setup my wordpress in a docker container, use nginx reverse proxy to forward all requests of location /blog to that docker container.

The problem is after logging in to wp-admin, it redirected to domain/wp-admin/ instead of /domain/blog/wp-admin.

What's the problem? I've set WP_SITE_URL and WP_HOME to /blog

6
  • Maybe you need to set rewritebase in htaccess Commented Jan 5, 2017 at 4:27
  • @NaveedRamzan: I found the problem is because it redirects to the wp-admin-canonical url which doesn't include /blog, I don't know why wp-admin-canonical value is wrong Commented Jan 5, 2017 at 4:49
  • ok that's nice that you have debugged yourself. Commented Jan 5, 2017 at 5:23
  • github.com/roots/trellis/issues/236 Commented Jan 5, 2017 at 6:04
  • @Vasim Vanzara Thanks for the comment but I don't see the answer there Commented Jan 5, 2017 at 7:19

1 Answer 1

9

This is what I did to fix it:

// add these lines to wp-config.php
define('WP_SITE_URL', 'http://domain.com/blog');
define('WP_HOME', 'http://domain.com/blog');

$_SERVER['REQUEST_URI'] = '/blog' . $_SERVER['REQUEST_URI'];
Sign up to request clarification or add additional context in comments.

3 Comments

I'm running into similar problem trying to deploy docker/container to url/path . But inside my container, the files are all in /var/www/html and not sub-dir. Is your install also in the root html dir or in subdir /blog?
I think you want to define WP_SITEURL variable instead of WP_SITE_URL
Great solution, saved my day!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.