Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter: how to serve static html pages in codeigniter context

Tags:

codeigniter

Hi all I want to serve some static html pages in codeigniter context. I dont want to bypass the index.php file in the base_url. But when I user the call to the HTML file, it dispays the 404 error page. I appreciate any help for this topic from guys who already solving this problem . Thanks for all in advance

I want to precise this elements:

  1. my real problem is to serve PDF file for users to display in the browser only an not to save the PDF file. So I convert the PDF to HTML Files. The output is a directory with HTML files linked betwen them and ther images/button, CSS, js for navigation
  2. when i put this HTML-OUTPUT in ci\Docs\HTML1 directory I can access it whith this URL localhost/ci/docs/html1/index.htm. But where i use localhost/ci/index.php/docs/html1/index.htm I get A 404 error page.
  3. So I moved The HMLT1 directory to the Application\views directory. And i stil have the same error. My .htacces look like this:

    <IfModule mod_rewrite.c>
    
    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
    
    </IfModule>
    

Thanks Guys for your help

like image 299
Rachidh Avatar asked Oct 18 '10 12:10

Rachidh


1 Answers

Create the static HTML file as a view and then just load the view:

$this->load->view('static.html');

You can then access this file as a normal controller. It all depends on how you have set up your .htaccess as well.

like image 188
Kieran Andrews Avatar answered Jan 04 '23 17:01

Kieran Andrews