Hi everyone,
I am facing an issue with Apache configurations on HestiaCP where I get an “RewriteEngine not allowed here” error resulting in a 500 internal server error.
Scenario:
- I am running a main site on maindomain.com (DocumentRoot: public_html).
- I have a requirement to point api.subdomain.com to a nested directory: public_html/Pay/api.
- My main domain relies on .htaccess rules in public_html/ for routing (index.php?i=$1).
The Problem:
When I point the subdomain to the nested directory, the public_html/.htaccess file causes an “RewriteEngine not allowed here” error because Apache seems to try to apply the parent directory’s .htaccess rules to the subdomain, which violates the AllowOverride restrictions.
What I have tried: - Pointing the subdomain root directly to the folder via HestiaCP settings.
- Attempting to use RewriteCond to bypass the domain in the .htaccess file, but the RewriteEngine command itself triggers the 500 error before the bypass conditions are even evaluated.
- Checked the logs, and they confirm: [core:alert] [client …] /home/user/web/domain/public_html/.htaccess: RewriteEngine not allowed here.
Question:
What is the recommended way to handle this on HestiaCP? How can I allow the subdomain to function in a subdirectory without being restricted by the parent directory’s .htaccess, or is there a way to properly configure AllowOverride for this specific path without compromising the entire server security?
Any guidance would be appreciated!