Welcome Guest, Not a member yet? Register   Sign In
.htaccess stops css from loading
#1

[eluser]jblack199[/eluser]
Okay so I've been working on this admin script im working on (just starting it really) and i've set my site up to remove the index.php from the url however i think because of that it's causing my css to now load...

When I visit my site http://name.domain.com/adm it automatically checks if I am logged in and if my account is still a valid user in the database. If i'm not logged in, or i'm not a valid user is redirects me to http://name.domain.com/adm/login

adm is a folder inside my controllers and my view folders. In the adm folder thats in the view, I have another subfolder called templates which holds template.php, header.php and footer.php

my header.php:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;link href="&lt;?php echo base_url();?&gt;css/adm/style.css"  type="text/css" media="screen" charset="utf-8"/&gt;
&lt;/head&gt;

&lt;body&gt;

This is working just as it should as in it links to the correct location: http://name.domain.com/css/adm/style.css

Problem is, it doesnt actually load the stylesheet and I think it has something to do with my .htaccess

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

Any help on figuring that out would be awesome.. thanks -- if you need any other files of code let me know and i'll post that up as well...
#2

[eluser]jblack199[/eluser]
Alright so after i posted this, I figured it out... The problem was the .htaccess folder, but more importantly the needing to add the ability to use the css folder... so now my htaccess looks like:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

There seemed to still be an issue with the way it was loading from the link, so i removed the media and charset and it seems to work fine now... I think in the near future I'll probably create an assets or inc folder and put my images, css, js in there so that I should only have to note the assets or inc folder in the css instead of having images|css|js and whatever else I need...
#3

[eluser]Aken[/eluser]
Try this .htaccess instead, see if you have better luck.
#4

[eluser]praveens[/eluser]
Try this

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
#5

[eluser]jblack199[/eluser]
I ended up using the .htaccess i posted above and it's working beautifully... being that this is going to be a full blown redistributable CMS just so I can say I did it, having everything routed through CI will be beneficial if i decide to distribute it to the masses as an alternative to joomla, wordpress or other bloated CMS's which options that most end-users wont use, cant use, or if they do use have the issue of breaking the entire site due to lack of knowledge of the function(s).




Theme © iAndrew 2016 - Forum software by © MyBB