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]
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]
对于绝对URL,你应该包括协议,它可能是这样的相对:
<link href='//www.jedendzien.pl/assets/css/style.css' rel='stylesheet'>
Try this .htacces content:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets)
RewriteRule ^(.*)$ /index.php/$1 [L]
Just empty the base_url(); in config.php file. And copy the text of .htaccess from the .htaccess file of codeigniter 3 from www.codeigniter.com.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.