0

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

2
  • try changing RewriteBase /~work2/ to RewriteBase/ only Commented Dec 10, 2013 at 4:15
  • it was already RewriteBase/ but that didn't worked so I changed to this. It is sure that something like mod_rewrite is not enabled on the server, as same .htaccess is working on another cpanel. But I want to know if disabled mod_rewrite can cause this issue or not? Or maybe one can suggest possible explanations Commented Dec 10, 2013 at 7:10

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.