I am trying to load CSS and JS files from a sub-domain.
The URL of my sub-domain is https://example.example.com
I am trying to load the style-sheets with the following statement:
<link rel="stylesheet" type="text/css" href="https://www.example.com/vendors/bootstrap/css/bootstrap.min.css">
When I navigate to https://example.example.com
I can see that the style-sheet is not loaded.
When I look at my web console, I can see the following error message:
GET https://www.example.com/vendors/bootstrap/css/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)
According to the message the file should not available. But when I click on the link I can see the content of bootstrap.min.css
. So my conclusion is the that the style-sheet does exist.
I also tried to upload the style-sheet to the page for the sub-domain. I tried the following statements:
<link rel="stylesheet" type="text/css" href="https://example.example.com/vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://www.example.com/example/vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../vendors/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../../vendors/bootstrap/css/bootstrap.min.css">
All of these returned the same error code.
When I navigate to https://www.example.com/example
instead of https://example.example.com
I can see that the style-sheet is working.
Does someone know how I can solve this problem?
Update:
I think pointing directly (https://www.example.com/vendors/bootstrap/css/bootstrap.min.css) to the page is always correct. There should be something else but I cannot discover what is wrong.
The style-sheet works on the pages
https://www.example.com/example/index.php
https://www.example.com/another/index.php
https://www.example.com/another/testpage.php
https://another.example.com/index.php
The style-sheet does not work on the following pages
https://example.example.com/index.php
https://another.example.com/testpage.php
Like you can see. The index page of the other subdomain (subdomain: another) is working. testpage.php is using the same style-sheets with the same pointing method:
<link rel="stylesheet" type="text/css" href="https://www.example.com/vendors/bootstrap/css/bootstrap.min.css">
Also the https://www.example.com/another/testpage.php is returning 404
Update 2:
Here is my httpd configuration:
<VirtualHost xxx.xxx.xx.xxx:80 >
ServerName www.example.example.com
ServerAlias www.example.example.com example.example.com
ServerAdmin webmaster@example.com
DocumentRoot /home/admin/domains/example.com/public_html/example
ScriptAlias /cgi-bin/ /home/admin/domains/example.com/public_html/example/cgi-bin/
UseCanonicalName OFF
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<IfModule !mod_ruid2.c>
SuexecUserGroup admin admin
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid admin admin
#RGroups apache access
RGroups @none
</IfModule>
CustomLog /var/log/httpd/domains/example.com.example.bytes bytes
CustomLog /var/log/httpd/domains/example.com.example.log combined
ErrorLog /var/log/httpd/domains/example.com.example.error.log
<Directory /home/admin/domains/example.com/public_html>
php_admin_flag engine ON
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f admin@example.com'
php_admin_value mail.log /home/admin/.php/php-mail.log
php_admin_value open_basedir /home/admin/:/tmp:/var/tmp:/opt/alt/php72/usr/share/pear/:/dev/urandom:/usr/local/lib/php/:/usr/local/php72/lib/php/
</Directory>
</VirtualHost>
<VirtualHost xxx.xxx.xx.xxx:443 >
SSLEngine on
SSLCertificateFile /usr/local/directadmin/data/users/admin/domains/example.com.cert.combined
SSLCertificateKeyFile /usr/local/directadmin/data/users/admin/domains/example.com.key
SSLCACertificateFile /usr/local/directadmin/data/users/admin/domains/example.com.cacert
ServerName www.example.example.com
ServerAlias www.example.example.com example.example.com
ServerAdmin webmaster@example.com
DocumentRoot /home/admin/domains/example.com/private_html/example
ScriptAlias /cgi-bin/ /home/admin/domains/example.com/public_html/example/cgi-bin/
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup admin admin
</IfModule>
<IfModule mod_ruid2.c>
RMode config
RUidGid admin admin
#RGroups apache access
RGroups @none
</IfModule>
CustomLog /var/log/httpd/domains/example.com.example.bytes bytes
CustomLog /var/log/httpd/domains/example.com.example.log combined
ErrorLog /var/log/httpd/domains/example.com.example.error.log
<Directory /home/admin/domains/example.com/private_html>
php_admin_flag engine ON
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f admin@example.com'
php_admin_value mail.log /home/admin/.php/php-mail.log
php_admin_value open_basedir /home/admin/:/tmp:/var/tmp:/opt/alt/php72/usr/share/pear/:/dev/urandom:/usr/local/lib/php/:/usr/local/php72/lib/php/
</Directory>
</VirtualHost>
Update 3:
Map structure:
www.example.com
- example (subdomain)
-- index.php
- another (subdomain)
-- index.php
-- testpage.php
- vendors (map)
Working:
Pointing from www.example.com/another/index.php and another.example.com/index.php to the `vendors` map.
Not working:
Pointing from www.example.com/example/index.php and example.example.com/index.php to the `vendors` map.
Pointing from www.example.com/another/testpage.php and another.example.com/testpage.php to the `vendors` map.