So I've used a .htaccess file which I searched for on here, I use this:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Which gets rid of the index.php file as wanted. I have the .htaccess file in the codeigniter directory. The website displays fine using this link with the trailing slash:
http://localhost/codeigniter/home/
But going to the link but without the slash after the home.php shows my website looking like it has not been linked to a css file. Any suggestions?
Also, in my config.php
file I have edited the index page:
$config['index_page'] = "";
If that makes any difference.
RewriteEngine on
# Next two lines get rid of trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
also base_url in config file should be
$config['base_url'] = 'http://localhost/codeigniter/';
You should post code from view file to let us determine what is going on. I assume you are using some kind of relative path though. Try using something like:
<link rel="stylesheet" type="text/css" href="<?php echo base_url('resources/css/main.css'); ?>">
Don't forget to load url helper before.