0

The css materialdesignicons.min.css and typicons.css are linked in header.php

root
 |--vendors
    |--mdi
       |--css
          |--materialdesignicons.min.css
 |--view
    |--header.php

header.php

*** The header.php original code 
< link rel="stylesheet" href="vendors/mdi/css/materialdesignicons.min.css" >

*** The header.php with dirname(__DIR__) 
 < link rel="stylesheet" href="<?php echo dirname(__DIR__) ?>/vendors/mdi/css/materialdesignicons.min.css">

When accessing the site with using .htaccess rewrite rule I'm getting an error.

    Not allowed to load local resource: file:///C:/xampp_v7_3_27/htdocs/mywebsite/vendors/mdi/css/materialdesignicons.min.css

However this is a valid path.

  • 1
    You are confusing file system paths, with URLs. – CBroe May 23 '23 at 11:48
  • Got it and it should not mixed up. How do I load the file correctly? – Nathan DevX May 25 '23 at 03:15
  • 1
    If you just use a path starting with a `/`, that is always relative to the web root. If you want to keep your project flexible, in that you could also put it into some sub-folder below the web root, then I would use a constant for the path prefix. – CBroe May 25 '23 at 05:33

0 Answers0