Support » Fixing WordPress » Incorrect admin redirects 404, WordPress Traefik subdirectory

  • moussamango


    Hi !
    I host a WordPress (5.4) website on my server.
    I use Traefik (2.2) as edge router and Docker (19.03) as provider.
    Currently, WordPress is in a docker which is accessible as a subdirectory of my subdomain.
    To access the wordpress site, I request:
    It is then routed by Traefik to the WordPress docker.
    The ‘siteurl and ‘home’ variables are updated in the database with the following value:
    The ‘wp-config.php’ is also edited with :

    define('WP_SITEURL', '');
    define('WP_HOME', '');

    I can access and navigate in the website. My homepage or any other page like are accessible and correctly redirected.
    In fact, the routing works quite well except in the ADMIN section.
    The redirection sent by WordPress from the ‘wp-admin’ pages are incomplete:
    – instead of having my whole site URL
    I get
    This returns HTTP 404 Not found. It misses the ‘/blog’ in the redirection…


    – When on the admin login, I log in, the wordpress log indicates:

    "POST /wp-login.php HTTP/1.1" 302 1184 "https://subdomain.domain/my_blog/wp-login.php?"

    The authentication is delivered but the ‘/my_blog’ is missing in the redirection. I can’t get to the correct route and a HTTP 404 is returned.
    The authentication is OK for the session. So, I can successfully access to the wp-admin dashboard by requesting:

    Yet, all the URLs generated in this admin dashboard page won’t refer to the:
    – instead they are just heading to ‘/some_file’
    So, HTTP 404 error answer when requested because Traefik doesn’t know this route:

    Strangely, all the ‘href’ in the admin dashboard ‘welcome_panel’ elements refers to the correct URL:
    (HTTP 200 OK answer when requested)

    Whereas, all ‘.php’ ref on the same dashboard lead to
    instead of:


    – Another strange thing is:
    When on the admin ulpoad page:
    (at https://subdomain.domain/my_blog/wp-admin/upload.php)
    All ‘href’ and ‘pages.php’ consider my full ‘site_url’ in their ‘href’. (HTTP 200 answer):
    "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 456 ""

    Current hypothesis:
    It seems some ‘href’ links correctly consider the ‘site_url’ variable while most of them don’t. They are all generated by a wordpress redirect so I suspect the issue is in WordPress, not in Traefik routing.

    I think about editing the ‘.htaccess’ file but I need help with it.
    Plus, isn’t the ‘.htaccess’ for rewriting the HTTP GET incoming requests?

    Thanks for the support !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.