Thịnh Phạm
Thịnh Phạm

Reputation: 2673

wrong wp-admin redirect when setting up wordpress inside subdirectory

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

Upvotes: 3

Views: 2359

Answers (1)

Thịnh Phạm
Thịnh Phạm

Reputation: 2673

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'];

Upvotes: 9

Related Questions