• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Include CSS... i'm lost

#1
[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! :-))

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

#3
[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!

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

#5
[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.

#6
[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 :-)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.