Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

base_url() and 403 error in CodeIgniter

In HTML view, css link code looks like this:

<link href='www.jedendzien.pl/assets/css/style.css' rel='stylesheet'>

but my browser is showing adress with double domain adress

www.jedendzien.pl/www.jedendzien.pl/assets/css/style.css

so i'm getting 403 error. I create link by

<link href='<?php echo base_url(); ?>assets/css/style.css' rel='stylesheet'>

and in config.php i'm setting:

$config['base_url'] = 'www.jedendzien.pl/';

In my XAMPP serwer everthing works fine but problem is appearig only on hosting server.

If i change $config['base_url'] = '' then adress looks and works ok but i still have problem with 403 error.

My .htaccess in root:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
like image 815
Bejkrools Avatar asked Jul 31 '26 04:07

Bejkrools


1 Answers

Change permission of assets/css/style.css to 644

Change base url as follows

$config['base_url'] = 'http://www.jedendzien.pl/';

Or If you have a secure url,Then

$config['base_url'] = 'https://www.jedendzien.pl/';

Change .htaccess to

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
like image 167
Shijin TR Avatar answered Aug 01 '26 17:08

Shijin TR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!