0

I have in my head links to CSS files, but it treats them like relative paths.

My domain structure is: https://example.com/folder/index.php folder including folders with CSS and images and include files

My CSS link looks like this: <link rel="stylesheet" href="css/style.css">

Everything is ok on the main page, but when I go to for example: https://example.com/folder/friends it's ok too. But at https://example.com/folder/friends/mine CSS doesn't load.

I have already tried:

<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="./css/style.css">

my .htaccess looks like this:

# enable rewrite engine
RewriteEngine On

# if requested url does not exist pass it as path info to index.php
RewriteRule ^$ index.php?/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?/$1 [QSA,L]

my index looks like this:

<?php
    include 'config/settings.php';

    include 'inc/head.php';
?>

<body>
<div class="page">
    <?php
        include 'inc/menu.php';

        include 'config/includes.php';
    ?>
</div>
</body>

In settings I exploding URL. And in includes I including files which I need to load.

In console it shows 200 to my styles

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Martys123
  • 1
  • 1
  • Possible duplicate of [CSS not loading after redirect with htaccess rewrite rule](https://stackoverflow.com/questions/8221022/css-not-loading-after-redirect-with-htaccess-rewrite-rule) – Masivuye Cokile Oct 21 '19 at 12:27
  • `In settings I exploding URL. And in includes I including files wich I need to load.` This isn't enough information to debug the problem. Are you URl rewriting the CSS folder? Where is the code for the rewrite? You only included the template, which is clearly not where the problem is. Please provide a [mre] – Machavity Oct 21 '19 at 12:27
  • That's better but we're still not there. What happens if you load `example.com/css/style.css` directly? – Machavity Oct 21 '19 at 12:31
  • How you mean directly? – Martys123 Oct 22 '19 at 19:15

0 Answers0