CSS not loading inside subdirectory
I am trying to load css from a sub directory via index.php and have defined a constant AMIN_CSS ="http://localhost/gbl_admin/admin_css"
.
The css is loaded in the same directory:
<link href="<?php echo ADMIN_PAGE."/style.css"?>" type="text/css" rel="stylesheet">
but this one is in a subdirectory:
<link href="<?php echo ADMIN_PAGE."/admin_css/style.css"?>" type="text/css" rel="stylesheet">
//constant decleration
define("SITEURL",'http://'.@$_SERVER['SERVER_NAME']."/");
define("ADMIN_PAGE",SITEURL."gbl_admin");
define("ADMIN_SCRIPTS",SITEURL."gbl_admin/admin_scripts");
define("ADMIN_CSS",SITEURL."gbl_admin/admin_css");
This one won't load! How can I solve this?
+3
source to share
1 answer
The second link you are talking about is perceived as
http: //localhost/gbl_admin/admin_css/admin_css/style.css
You can see that admin_css is being repeated twice, so it cannot load the CSS file. Hence, the correct URL should be as follows:
+1
source to share