Skip to content

Subdirectory problem (wp-admin redirect) #388

@forcemagic

Description

@forcemagic

I have looked through several related issues, but could not find a solution. It only happens when I'm at /wp-admin.

I get a sort of 'redirect' when I access wp-admin. Seems like a pushState. Found this thing:

<link id="wp-admin-canonical" rel="canonical" href="https://example.com/wp-admin/">

...which is incorrect, because I want it to be in a subdirectory. Where does this tag get its information from? I have set WP_HOME and WP_SITEURL variables (see below).

docker-compose.yml:

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8010:80"
     restart: always
     environment:
       WORDPRESS_CONFIG_EXTRA: |
         define('WP_HOME', 'https://example.com/subdir');
         define('WP_SITEURL', 'https://example.com/subdir');
         define('DOMAIN_CURRENT_SITE', 'example.com');
         define('PATH_CURRENT_SITE', '/subdir/');
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
       WORDPRESS_DB_NAME: wordpress
volumes:
    db_data: {}

EDIT: Because I'm using nginx, let me just post my config for that too...

        location /subdir/ {
                proxy_pass http://localhost:8010/;
                proxy_redirect off;

                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-Ip $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions