Search code examples
codeigniterproduction-environment

Codeigniter - cannot load files in production server


I have problem that cannot load any css, js, images, etc in production server.

Error resource: the server responded with a status of 404 (Not Found)

This is the my folder tree

public_html/
    application/
    assets/
    ...

I'm using base_url() when try to load any file in assets directory,

example: <link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/bootstrap.css"); ?>" />

I have no idea why i can't load such as those files. Can anyone please help me with this issue?

.htaccess file

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

Solution

  • Options Indexes FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    Please use this .htacess