Codeigniter shows views differently when index is removed

Tags: css,codeigniter,routing

Problem :

I'm working in Codeigniter and Apache with a virtual host set up and have have added a .htaccess file to the rout directory (next to the index.php) with the following code

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

My view file is in another location outseide of the route and I have updated the index.php file to reflect this as below.

$system_path = '../CI/system';
$application_folder = '../CI/application';
$view_folder = '../CI/views';

If I access my website using the following addess it renders perfectly


However if I use any of the following it renders without applying any css etc.


Is anyone able to suggest why this is and how I can get around it? I've searched around but been unable to find any suggestions.

Solution :

Go to config/routs.php

Change this

$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Path - config/config.php

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

in your XAAMP Control Panel.

Go to->Config->php.ini

Replace this


in .htacess file

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

to avoid css loading error.

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

    CSS Howto..

    How to display text on the same line?

    How to make CSS visible only for Opera

    How to change the opacity of elements in css?

    How to make an image appear over another image when mouse hovers with css3?

    How to Change the hover image in CSS

    CSS select: how to count and select child of a specific class only?

    Integration of CSS, Javascript and html ,,,howto

    How to set color of the Button with jQuery UI?

    First and Second touch of a button, how to show images at different times?

    show one div but hide all other divs is not working

    How to customize HTML/CSS tooltips?

    How to set CSS hover on input

    How do you stop a single-page site from automatically scrolling when resizing the browser?

    How to create full height content section with fixed header and footer in CSS with scrollbar hidden if not required [closed]

    How do you get multiple views in one window like JSFiddle does [closed]

    How to change the value depend on css animation?

    How to change css style by using Unicode Hexadecimal

    How do CSS sprites speed up a web site?

    How would I get my horizontal navigation bar to span the full width?

    How to change social network icons colors in fixed menu?

    CSS dropdown menu not showing the full texts of submenu items

    How To Add % Based Image To CSS? (for fluid layout)

    How to make a CSS border for a dropdown menu?

    How to get these tables stacked on top of each other?

    How to get cross browser compatibility in Print on page from all browsers?

    How to make a fixed position centered after zooming the whole website out?

    How to Convert this Inline CSS to External CSS using just a single class?

    How can my css div with the display flex property be alignd to the right when it's wrapping?

    How to use JSF generated HTML element ID with colon “:” in CSS selectors?

    How to add a CSS specifc for Google Chrome? [duplicate]