ZeroVash
ZeroVash

Reputation: 558

Empty css file in loading index.php

In a way of divide php code from HTML. I got a problem in loading css file. So I have php file index.php, css file - main.css,and html files front.html and log_in.html

<?php

    $door = file_get_contents("log_in.html");
    $Page = file_get_contents("Front.html");
        $Page = str_replace("{{Door_frame}}", $door, $Page); 
    echo $Page;  // if you know better variant to get page from php please let me know.

?>

Here I try to put the login container in front.html page. I thing it is better to do that create another similar page.

if I go to directory localhost/my-site/ (it automatically take index.php or index.html if i understand correct) it show me the website perfectly. Everything work. But as soon as I get localhost/my-site/index.php it get me page with empty css file (see the attached pictures). So the question: why does it happening? Is it not the same address localhost/my-site/ and localhost/my-site/index.php?

enter image description here enter image description here

Upvotes: 0

Views: 2099

Answers (1)

Piotr Kliks
Piotr Kliks

Reputation: 411

What happens if you enter localhost/site-final/index.php (without / on the end)? I think it's trying to load localhost/site-final/index.php/css/main.css when you have index.php/. You could use absolute path to your css file (http://localhost/site-final/css/main.css).

Upvotes: 1

Related Questions