0

My website is working fine. All controllers works fine unless I put a slash at the end the pages broke.

Here is oringal URL: Saaf.Pk

But when I put a slash at the end, style & images broked: Here

I know the problem is that URL path got changed. But what's the general solution for this situation?

My .htaccess

<IfModule mod_rewrite.c> 
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
kamranbhatti585
  • 232
  • 2
  • 16
  • show us your .htaccess and config/routes.php, also see: https://stackoverflow.com/questions/1741505/code-igniter-url-routing-question-using-trailing-slashes and https://stackoverflow.com/questions/36524343/handle-trailing-slash-with-codeigniter-3 and https://stackoverflow.com/questions/13354265/codeigniter-url-trailing-slash-breaks-in-subfolder – Vickel Dec 07 '19 at 12:58

2 Answers2

1

are you using base_url to define every image, js, css etc?

example img

<img src="<?=base_url('assets/uploads/cms/') . $cms->logo_2?>" alt="Logo">

example js

<script src="<?=base_url('assets/plugins/jquery-3.3.1/jquery.min.js')?>"></script>

example css

<link href="<?=base_url('assets/guide/css/hopscotch.css')?>" rel="stylesheet"/>
Doelmi
  • 150
  • 7
1

First of all, set the base_url in config folder config.php location in application->cofig->config.php and use as $config['base_url'] ='https://saaf.pk/';

Than give the link of images, css and js as ">

Don't forget to use the helper URL in autoload.php file.

kapil
  • 17
  • 5