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
RewriteBase /~work2/toRewriteBase/onlyRewriteBase/but that didn't worked so I changed to this. It is sure that something likemod_rewriteis not enabled on the server, as same .htaccess is working on another cpanel. But I want to know if disabledmod_rewritecan cause this issue or not? Or maybe one can suggest possible explanations