Welcome Guest, Not a member yet? Register   Sign In
Asset folder in root inaccessible
#1

[eluser]Chromana[/eluser]
I'm setting up a new website and trying to make it better than my previous COdeIgniter efforts.
I'm putting an asset folder in root, as described by this post http://ellislab.com/forums/viewthread/66887/#334093 i.e. at the same level as index.php and the system folder.
I am using the following in files:

Code:
<base href="<?php echo $this->config->item('base_url') ?>asset/" />
<link rel="stylesheet" href="css/base.css" type="text/css" />

However, I get a 404 for www.mysite.com/asset/css/base.css and also just for www.mysite.com/asset/.
Do I need to add something to routes to get this to work? At the moment I just have the default of:
Code:
$route['default_controller'] = "ctrl_main";
$route['404_override'] = '';
I get a 404 for any file in the asset folder. How do I fix this?
Many thanks!
#2

[eluser]Chromana[/eluser]
Actually, I've discovered that it is my .htaccess file which is messing with stuff. I'm using the one described here: http://ellislab.com/codeigniter/user-gui.../urls.html
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
Once this is removed all asset files can be accessed. However, I'm a complete newbie with htaccess files and have no idea how to fix this.
#3

[eluser]InsiteFX[/eluser]
Code:
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond $1 !^(index\.php|assets|css|js|images|img|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
#4

[eluser]Chromana[/eluser]
[quote author="InsiteFX" date="1340915609"]
Code:
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond $1 !^(index\.php|assets|css|js|images|img|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
[/quote]
Thank you so much sir, you have solved my problem. Gold star for you.




Theme © iAndrew 2016 - Forum software by © MyBB