Welcome Guest, Not a member yet? Register   Sign In
Have CI ignore static asset files request in index.htm?
#1

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?).
Reply
#2

(This post was last modified: 11-07-2016, 05:08 AM by InsiteFX.)

Add the html base ref tag to your html head section.

Code:
<head>
   ...
   <base href="<?php echo base_url();?>">
   ...
</head>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(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?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB