I have a site developed in Yii2 on a VPS (Apache 2.4.23) structured like this:
user/app (all the sites files and directories)
user/public_html
In public_html there are links to directories and files such as:
.htaccess (file folder)
admin (file folder)
assets (file folder)
css (file folder)
images (file folder)
index (php file)
The psite has a frontend and backend, the backend is on a subdomain, and frontend on the domain (example.com and admin.example.com)
Frontend load fine both with http and https, whereas the backend does not load the assets (css and images), https on backend redirects to http which I don't want to.
On the error logs I see a bunch (too many to list them all) of errors, like the following samples:
[access_compat:error][pid][client]AH01797:client denied by server configuration: home/user/app/backend/web/index.php, referer http://admin.example.com/en/user/index
[access_compat:error][pid][client]AH01797:client denied by server configuration: home/user/app/backend/web/index.php
[access_compat:error][pid][client]AH01797:client denied by server configuration: home/user/app/backend/web/en
The htaccess files are the same for frontend and backend like this:
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php [L]
# use index.php as index file
DirectoryIndex index.php
I also tried (suggested by hosting support) with no success.
# use mod_rewrite for pretty URL support
RewriteEngine On
# enable symbolic links
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]
# use index.php as index file
DirectoryIndex index.php
Could you please tell me what's wrong and why frontend works fine, but the backend does not?