0

when I load the url:

http://icetopup.tk/secure/login

it works. but when I load:

http://icetopup.tk/secure/login/

it shows page content but without css. anybody know how to solve that?

Shuhail
  • 58
  • 1
  • 9

1 Answers1

0

I guess you have relative paths to your CSS files in your template. The two paths will work the same in CodeIgniter, but they have a very different meaning from the browser's perspective:

http://icetopup.tk/secure/login means: the resource 'login' in the directory 'secure', so '/secure/' is the offset directory for relative paths.

http://icetopup.tk/secure/login/ means: the default document from the directory 'login', so '/secure/login/' is the offset directory for relative paths.

To solve this, make sure to use the base_url() function:

<link rel="stylesheet" href="<?=base_url()?>/css/yourfile.css">

or

<link rel="stylesheet" href="<?=base_url('css/yourfile.css')?>">

This function is in the URL helper file, so you'll need to load that, if you didn't do so already.

See also:

Community
  • 1
  • 1
GolezTrol
  • 114,394
  • 18
  • 182
  • 210