we are trying to run flarum in a subdirectory at
https://chweb/computerhelp/cmstest/forum
the installation completes without errors and the forum frontend loads normally. the main page renders, forum.js initializes, and css, fonts and javascript files load successfully, which indicates that php execution, database connection and the flarum core installation itself are working.
however all api requests fail. requests such as
/forum/api/tags
/forum/api/token
/forum/api/...
return a plain apache 404 response instead of a flarum json response. this means the request never reaches the flarum router and apache attempts to resolve the path as a physical file instead of rewriting it to index.php.
opening the endpoint directly
https://chweb/computerhelp/cmstest/forum/api/tags
returns the standard apache error page “not found – the requested url was not found on this server (apache/2.4.52 ubuntu)”.
the forum homepage itself works and the following assets load correctly:
forum.css
forum.js
forum-en.js
font files
network inspection shows that the javascript application runs normally and triggers the api request for tags, but that request receives a 404 directly from apache.
this indicates that the rewrite rule that should forward /api/... requests to index.php is not being applied correctly even though the .htaccess file exists in the forum directory.
we verified the following:
the flarum installation runs without errors
the forum frontend loads correctly
php executes normally
database connection works
file permissions are correct
apache reads .htaccess files (tested by inserting invalid directives and observing server errors)
rewrite rules were replaced with the official flarum rules
the config.php url matches the actual forum url
the index.php file exists and loads correctly
we also tried both possible installation structures:
in addition we manually cleared all generated data including:
we also tested forcing rewrite rules for /api requests in the .htaccess file but the result remained the same: the request never reaches index.php and apache returns a direct 404.
this troubleshooting process was done over the course of a full day together with a programmer with about 45 years of experience and myself as a software development apprentice. we also followed several youtube tutorials and repeated the installation multiple times from scratch.
in summary:
the flarum installation succeeds
the frontend loads correctly
php execution works
the database connection works
static assets load normally
but every api endpoint returns a direct apache 404 because the request is not rewritten to index.php
has anyone experienced a similar issue with flarum api routes returning apache 404 in a subdirectory installation and does anyone perhaps have any ideas for possible solutions?

