0

Can't load css files getting error 404 using codeigniter.

here is my link tag

<head>

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

<head>

server folders

-httpdocs
---application
---cgi-bin
---css --> style.css
---system
---user_guide

error

GET http://31.8.7.79/css/style.css 

Im not sure if it could be a problem but for some reason codeigniter uses this http adress http://31.8.7.79/ instead of http://www.someurl.com could it be because of Apache Server?

Tried to do same exact thing with different server without Apache Server and it works perfectly

1
  • You must set your base url in config.php else links won't work properly Commented Apr 3, 2017 at 20:49

2 Answers 2

4

In the file application/config/config.php set the base_url item as follows and see if that helps

$config['base_url']  = 'http://www.someurl.com/';
Sign up to request clarification or add additional context in comments.

Comments

0

Config.php

$config['base_url']  = 'http://www.someurl.com/';

.htaccess

RewriteEngine on

RewriteCond $1 !^(index\.php|css|(.*)\.css|(.*)\.js|(.*)\.jpg|(.*)\.jpeg|(.*)\.png|(.*)\.bmp|(.*)\.gif|(.*)\.doc|(.*)\.shtml|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ ./index.php/$1 [L]

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.