CodeIgniter Forums

Full Version: Have CI ignore static asset files request in index.htm?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a themes folder outside the CI folder structure. I use CI to route to a given active theme. This is of course done in a controller. I make a check for an index.php file in the active theme folder, and if it doesn't exist I serve an index.htm file instead (to make it possible to have pure static sites served).

Now my problem is, that all assets in this (static) index.htm file trigger a File Not Found error.

How can I make CI ignore all request made from a static .htm file like these:


Code:
<link rel="stylesheet" href="css/style.css">
<script src="js/main.js"></script>

I already have a route setup that handles all other pages to that theme, like so:


Code:
$route['default_controller'] = 'front';
$route['admin'] = 'backend';
$route['(:any)'] = 'front/index/$1';

Or should this be handled in the .htaccess file instead (and if, then how would I set it up?).
Add the html base ref tag to your html head section.

Code:
<head>
   ...
   <base href="<?php echo base_url();?>">
   ...
</head>
(11-07-2016, 05:07 AM)InsiteFX Wrote: [ -> ]Add the html base ref tag to your html head section.

Code:
<head>
   ...
   <base href="<?php echo base_url();?>">
   ...
</head>

Cannot do that. This is an .htm file. So not PHP in here ... did you read my question?