Bi-lingual site, two Contexts: Problem with site_start on second Context

I am running Modx 3.2.0 on an Apache server (Hostinger) with PHP 8.4. It is a development environment, so my site is in a subdirectory (/bandfg).

It is a bi-lingual site with two Contexts: ‘web’ for English (‘en’) and ‘mak’ for Macedonian (‘mk’). I am using LangRouter for the routing and Babel to link the pages.

Everything is working perfectly.

However, I wanted to use a piece of software that is not a Modx Extra, and it needs its PHP files to be held in a folder similar to ‘assets’, with a piece of HTML in the appropriate resource to execute it. For this, I had to create a /mk subdirectory under /bandfg - i.e. /bandfg/mk - to hold the PHP files so that they were available for the ‘mak’ context.

Again, everything is working perfectly … with one exception.

When I attempted to link to the ‘mak’ home page, I got a 403 error. This was fixed by copying into the /mk subdirectory index.php and config.core.php, and editing index.php to initialise ‘mak’ rather then ‘web’. However, I still have a problem, because instead of presenting the ‘mak’ home page (resource number ‘2’), it presents the ‘web’ home page (resource number ‘1’).

The workaround is to set the ‘mak’ site_start parameter to something other than ‘2’. Linking to the Macedonian home page from within the menu system now presents the correct page, but under the URL {mywebsitename}/bandfg/mk/index.html.

However, if someone should try to link to the site from outside by specifying the URL {mywebsitename}/bandfg/mk, they will be presented with the English (‘web’) home page rather than the Macedonian one (‘mak’).

Even if I go into the manager, bring up resource ‘2’, and click on [View], it presents me with the ‘web’ home page (resource ‘1’).

Intuitively, I would have assumed that when the system gets the URL {mywebsitename}/bandfg/mk it would look to see if there is a /mk subdirectory and, finding that there is, check for the existence of index.php and config.core.php, which it does; and we know that because if either of them is absent we get an error message. So, finding index.php in /mk, it would then execute that file, which initialises the ‘mak’ context, and it would then go to the site_start resource for ‘mak’ and present that page. But it does NOT do this. Instead, it presents the site_start for the default ‘web’ Context.

Can anyone give me any insight into why this is might be happening and suggest how to fix it?

Thanks in advance for any help offered.

I am not sure, whether LangRouter works in an external subfolder installation. Maybe you should use SmartRouting there.

(post deleted by author)

(post deleted by author)

(post deleted by author)

(post deleted by author)

The ‘fr’ Context does NOT have an associated sub-directory; ‘de’ and ‘mk’ DO.

In the two sub-directories I have two files: index.php and config.core.php.

I have editted config.core.php to locate the core/ directory in the parent directory (i.e. /bandfs/)

I have editted index.php to initialise the ‘de’ or ‘mk’ Context, as appropriate.

With this setup, everything is working perfectly … with one exception!

I am still having the same problem with SmartRouting as I have with the LangRouter installation.

A request to …/fr will correctly display the site_start page for the the ‘fr’ Context.

A request to either …/de or …/mk will display the default System site_start - i.e. Resource ‘1’.

An internal link to the ‘mk’ home page (Resource ‘5’) correctly displays the Resource ‘5’ page, having ‘index.html’ in the URL.

An internal link to the ‘de’ home page (Resource ‘7’), which builds the URL without ‘index.html’, displays the default site_start (Resource ‘1’).

In short, it would appear that if there is a sub-directory associated with the Context, and the incoming request does not include a file name, the site_start parameter is ignored when the incoming request is being processed, and the default site_start is displayed instead.

However, if there is NOT a sub-directory associated with the Context, the site_start parameter for that Context IS processed, and the Resource identified by site_start is displayed.

Since the same issue arises with both LangRouter and SmartRouting, there must be something in the setup which needs to be corrected.

Has anyone come across this issue before and, if so, what did you do to resolve it?