CodeIgniter Forums
Include CSS... i'm lost - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Include CSS... i'm lost (/showthread.php?tid=53744)



Include CSS... i'm lost - El Forum - 08-07-2012

[eluser]Hana[/eluser]
Hello :-)

Since yesterday, I am trying to import my CSS in my header page...

My header:
C:\wamp\www\MYSITE\application\views\Common\header.php

My css:
C:\wamp\www\MYSITE\application\assets\css\master.css

In autoload, I included url helper. In each controller I load view "header" (like this)
Code:
$this->load->view('common/header');
  $this->load->view('login');

I tried
Code:
<link href="<?php echo base_url(); ?>application/assets/css/master.css" rel="stylesheet" type="text/css">
And it load [13:38:57,314] GET http://localhost/MYSITE/application/assets/css/master.css [HTTP/1.1 404 Not Found 2ms]

I do not get what is the link ref to my css...


I have an .htaccess in MYSITE(before application & system):
Options -Indexes
RewriteEngine on
RewriteCond $1 !^(index\.php|assets/|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

And an .htaccess in application, but I disabled it:
Deny from all

What did I do wrong? Sad

Thanks in advance for any help! :-))


Include CSS... i'm lost - El Forum - 08-07-2012

[eluser]michalsn[/eluser]
Code:
RewriteCond $1 !^(index\.php|application|robots\.txt)



Include CSS... i'm lost - El Forum - 08-07-2012

[eluser]Hana[/eluser]
Okkk!

It works :-)) Thank you!
I had to remove the second htaccess with Deny from all, because it blocks the access to my css.

Yupi!


Include CSS... i'm lost - El Forum - 08-07-2012

[eluser]InsiteFX[/eluser]
If you put it in the root with index.php you would not of had that problem.



Include CSS... i'm lost - El Forum - 08-07-2012

[eluser]CroNiX[/eluser]
[quote author="Hana" date="1344343341"]Okkk!

It works :-)) Thank you!
I had to remove the second htaccess with Deny from all, because it blocks the access to my css.

Yupi![/quote]
Yeah, it's supposed to block access. Did you think that was a mistake? You just removed an important piece of security. You are not supposed to be able to directly access anything in the /application or /system directory via the url. That's very insecure.

Your assets (images, css, javascript) should not be in /application or /system.


Include CSS... i'm lost - El Forum - 08-08-2012

[eluser]Hana[/eluser]
Ok then... I understand now why I had this problem...
I'll move my "assets" to root out of Application Folder :-) thanks for the tips!

So I moved assets folder back to root.
Then I modified again my .htacces in root:
RewriteCond $1 !^(index\.php|assets|robots\.txt)
To finish, I put back the .htaccess with Deny from all in my folder Application (& System).

Everything is secure & works! Great and thank you :-)