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.

3
  • 1
    You are confusing file system paths, with URLs. Commented May 23, 2023 at 11:48
  • Got it and it should not mixed up. How do I load the file correctly? Commented May 25, 2023 at 3: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. Commented May 25, 2023 at 5:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.