Q:

Can’t access admin when WordPress is in a subfolder

I installed WordPress using this Docker image. I installed WordPress in a sub-folder (https://thibault.vlacich.fr/blog).
I’m using Traefik for routing. Here’s my docker-compose file:
version: '3.7'

networks:
  http_network:
    external: true
  thibaultvlacich:
    external: false

services:
  database:
    image: mariadb:latest
    command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', '--default-authentication-plugin=mysql_native_password']
    volumes:
      - .docker/data/db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    networks:
      - thibaultvlacich

  wordpress:
    depends_on:
      - database
    image: wordpress:latest
    volumes:
      - ./wordpress/wp-content:/var/www/html/wp-content
    environment:
      WORDPRESS_DB_HOST: database:3306
      WORDPRESS_DB_USER: ${MYSQL_USER}
      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
      WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:thibault.vlacich.fr;PathPrefix:/blog;PathPrefixStrip:/blog
      - traefik.port=80
      - traefik.docker.network=http_network
    networks:
      - thibaultvlacich
      - http_network

Everything is working fine, at the exception of the admin. When I go to https://thibault.vlacich.fr/blog/wp-admin, I’m redirected to https://thibault.vlacich.fr/wp-admin, and then can’t access the admin.
Any idea how I could fix that? (Both WP_HOME and WP_SITEURL are correctly set to https://thibault.vlacich.fr/blog)

A:

I ran into the exact same issue as you.   I've been troubleshooting off and on for weeks and lost half my hair trying to figure this out.  I think I finally figured it out.  
Create a directory in ./wordpress/wp-content called blog and move all your data in there.  Then make your docker compose look like   
version: '3.7'

networks:
  http_network:
    external: true
  thibaultvlacich:
    external: false

services:
  database:
    image: mariadb:latest
    command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', '--default-authentication-plugin=mysql_native_password']
    volumes:
      - .docker/data/db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    networks:
      - thibaultvlacich

  wordpress:
    depends_on:
      - database
    image: wordpress:latest
    volumes:
      - ./wordpress/wp-content:/var/www/html/wp-content
    environment:
      WORDPRESS_DB_HOST: database:3306
      WORDPRESS_DB_USER: ${MYSQL_USER}
      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
      WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:thibault.vlacich.fr;PathPrefix:/blog
      - traefik.port=80
      - traefik.docker.network=http_network
    working_dir: /var/www/html/wp-content/blog
    networks:
      - thibaultvlacich
      - http_network

Now It has a weird quirk that I don't think you'll have an issue with since you're up and running.  When you first configure the wordpress site you'd have to go to https://thibault.vlacich.fr/blog/blog to go through the installation process.  When complete you should be able to go to https://thibault.vlacich.fr/blog and access it fine.  I was having the same issue where /blog/wp-admin would redirect removing the /blog and now I don't.  If that doesn't work let me know and I'll post my docker-compose.yml file and you can modify yours to match.

