ashutosh
ashutosh

Reputation: 1232

Codeigniter css not found (htaccess issue)

I am using cPanel to host my codeigniter app. It is running fine on localhost. But when I uploaded it to server, it gave 404 error for all CSS files and hence it is showing the webpage without any CSS included(all assets links broken).

I used the browser inspector to see that it was 404 errors(issued by server, not CodeIgniter). Here is link for CSS:

http://xxx.xx.xxx.xx/~demo/assets/css/bootstrap.css //server 404 error

Then I tried to access the CSS files by native method, i.e:

http://xxx.xx.xxx.xx/~demo/index.php?/assets/css/bootstrap.css //CodeIgniter 404 error

which issued CodeIgniter's 404 error.

This looks like I am having some issue with the htaccess Here is my htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /~work2/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>

I am able to get the main page of the website, i.e default controller, but could not get other pages, like about us, etc.

I have tried other solutions but nothing seems working. Can anyone rectify the problem. PS: I had tried installing cakePHP before it, end up having same issue with that too

Upvotes: 0

Views: 2627

Answers (2)

Bjorn
Bjorn

Reputation: 308

You need to change your .htaccess file so that it no longer rewrites requests made to '/assets'.

See this answer for the details: https://stackoverflow.com/a/27285645/508905

Upvotes: 1

Sandeep Mehra
Sandeep Mehra

Reputation: 67

In css folder create .htaccess file and write Allow from all then try

Upvotes: 0

Related Questions