this is weird. I copied a website my computer from ftp, then to the other folder of my computer. Try to go to localhost/darzelis - and see a content without styling.

Checked google chrome console:

Resource interpreted as Stylesheet but transferred with MIME type text/html. FreshMedia.css:-1

When I view the source, I see:

<link rel="stylesheet" href="localhost/darzelis/images/FreshMedia.css" type="text/css" />

It looks that everything is ok..

Why is that, I cannot understand.

I developed that website using localhost and everything worked, then uploaded to ftp. And now downloaded and there is no css.

I changed the include line to

<link rel="stylesheet" href="images/FreshMedia.css" type="text/css" />

and it works. But its interesting why it did work when there was full url and on localhhost does not..

no, actually it does not work.. It only works for home page, but when I go to different page, there is no css againg. What can there be?

And at the same time the link works somehow not well. I check the source code - the link is such and ok:

<a href="localhost/darzelis/darbuotojai">Darbuotojai</a>

When I click on that link, it goes to


I understand nothing :D what the hell is that? :)

You actually have a folder named localhost?? That can be confusing, since your local URL is localhost. Personally I wouldn't have a folder named that.

As a rule I generally keep my stylesheets in a folder called styles, or even in the root of the html files I'm linking too. ie

<link href="rlb.css" rel="stylesheet" type="text/css" />

I'm sure you problem has to do with defining the relative path incorrectly.

No, I don't have a folder name 'localhost'. The website is in folder 'darzelis'. I found that css works now when I use relative path for valid urls, those links confused me. When I went to such


then style was gone, but actually there is no such URL, so it just shows a message but without styling (it should still show wtih styiling). When I go to existing url, then styling is ok.

But still I don't get why it goes to a wrong url when I click on link :/ even when I mouse over the link, at the bottom of the browser I see the wrong link. But in source code I check and the link is ok :/

I guess I found the problem. This is sick. There is a config file where I have to enter a sites base_url. So when I dowloaded the website, I changed it to

$config['base_url'] = "localhost/darzelis/";

But I had to chancge to

$config['base_url'] = "http://localhost/darzelis/";

I don't even know what to say :D How such stupid http:// can mean so much? This is codeigniter framework 1.7.3, why doesn't it throw some error that there is no http:// in base_url ? Ok, in 2.0 version I don't even need this, it automatically detects a url.

And for css I had to use full path, otherwise it does not see css in some of the pages

<link rel="stylesheet" href="<?php echo base_url()?>images/FreshMedia.css" type="text/css" />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.