I am using an unusual setup to host 3 Wordpress installations on CentOS 8 Linux.

In front I have HAProxy (to offload TLS), then I have [Jetty configured for FastCGI](https://www.eclipse.org/jetty/documentation/jetty-9/index.html#configuring-fastcgi) and php-fpm and finally Wordpress.

I am using the Wordpress around a word game written in Pixi.js.

For several years now I have been using 3 different IP-addresses and 3 different domain names for the 3 language versions of my game: en, de, ru.

However my word game is not successful, so I have decided to give up the additional domain names and IP addresses and just use folders to serve my game:

* wordsbyfarber.com/en
* wordsbyfarber.com/de
* wordsbyfarber.com/ru

This has worked well, I am not using multisite and I have set

```
define('WP_HOME', 'https://wordsbyfarber.com/en');
define('WP_SITEURL', 'https://wordsbyfarber.com/en');

```

in en/wp-config.php (same for de and ru) and also in the dashboard:

[![dashboard](https://i.stack.imgur.com/g5YvK.png)](https://i.stack.imgur.com/g5YvK.png)

And already you can see my problem in the above screenshot:

While the user-facing websites work ok, the admin dashboard at `/en/wp-admin/` immediately redirects to `/wp-admin` which is not ok, since I am not using multisite.

I have tried to solve the problem myself and searched a lot in the docs etc.

Also I wondered, who is doing the redirect, is it JS or PHP?

It seems to me that this is done by the PHP code of Wordpress, which for some reason sends a new `Location` header:

[![wget](https://i.stack.imgur.com/alVmX.png)](https://i.stack.imgur.com/alVmX.png)

As you can see in the above screenshot, when using `wget` - for some reason Wordpress would remove `/en` string from `/en/wp-admin` path and redirect to the new location.

Why is it doing so and how to stop it?

I have tried to search in Wordpress source code with:

```
find ./en/ -iname \*.php| xargs grep -riw redirect_to

```

but wasn't able to find the reason yet.

**UPDATE:** I do not have any .htaccess file, because I am using [Jetty configured for FastCGI](https://www.eclipse.org/jetty/documentation/jetty-9/index.html#configuring-fastcgi) with the following config file:

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
    "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">

    <New id="root" class="java.lang.String">
        <Arg>/var/www/html/wordsbyfarber.com/en</Arg>
    </New>

    <Set name="contextPath">/en</Set>
    <Set name="resourceBase"><Ref refid="root" /></Set>

    <Set name="welcomeFiles">
        <Array type="string">
                <Item>index.php</Item>
                <Item>index.html</Item>
        </Array>
    </Set>

    <Call name="addFilter">
        <Arg>org.eclipse.jetty.fcgi.server.proxy.TryFilesFilter</Arg>
        <Arg>/*</Arg>
        <Arg>
            <Call name="of" class="java.util.EnumSet">
                <Arg><Get name="REQUEST" class="javax.servlet.DispatcherType" /></Arg>
            </Call>
        </Arg>
        <Call name="setInitParameter">
            <Arg>files</Arg>
            <Arg>$path /index.php?p=$path</Arg>
        </Call>
    </Call>

    <Call name="addServlet">
        <Arg>
            <New class="org.eclipse.jetty.servlet.ServletHolder">
                <Arg>default</Arg>
                <Arg>
                    <Call name="forName" class="java.lang.Class">
                        <Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
                    </Call>
                </Arg>
                <Call name="setInitParameter">
                    <Arg>dirAllowed</Arg>
                    <Arg>false</Arg>
                </Call>
                <Call name="setInitParameter">
                    <Arg>gzip</Arg>
                    <Arg>true</Arg>
                </Call>
            </New>
        </Arg>
        <Arg>/</Arg>
    </Call>

    <Call name="addServlet">
        <Arg>org.eclipse.jetty.fcgi.server.proxy.FastCGIProxyServlet</Arg>
        <Arg>*.php</Arg>
        <Call name="setInitParameter">
            <Arg>proxyTo</Arg>
            <Arg>http://localhost:9000</Arg>
        </Call>
        <Call name="setInitParameter">
            <Arg>prefix</Arg>
            <Arg>/</Arg>
        </Call>
        <Call name="setInitParameter">
            <Arg>scriptRoot</Arg>
            <Arg><Ref refid="root" /></Arg>
        </Call>
        <Call name="setInitParameter">
            <Arg>scriptPattern</Arg>
            <Arg>(.+?\\.php)</Arg>
        </Call>
    </Call>
</Configure>

```