cancel
Showing results for 
Search instead for 
Did you mean: 

magento CSS files not loading with https url

magento CSS files not loading with https url

i have installed SSL certificate and now when i access the website https://www.deals4u.co.il CSS files are not loading. CSS files are loading in not secured url http://www.deals4u.co.il. please help me solve this issue. i tried to deploy but that did not help. maybe permissions issue? also url link inside the website returning 404: example

https://www.deals4u.co.il/acer-predator-helios-300-gaming-laptop.html

15 REPLIES 15

Re: magento CSS files not loading with https url

Looks like its permission issue and i am also able to see deployed version number in URL at browser console.

 

so below are the two possible solution.

 

1) set the required permission

 

 

chmod -R 777 var
chmod -R 777 pub

 

2) Disable deployed version in url by running below query.

 

 

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);

 

If its gives duplicate entry error then open your core_config_data table

 

check for a path - dev/static/sign and check its value. Make sure its value is 0 (zero)


Below is Alternate option : 

 

remove generated, var/cache, var/page_cache and pub/static directory

 

then again run deploy command for both Hebrew language and general as mention below :

 

 

php bin/magento setup:static-content:deploy he_IL

php bin/magento setup:static-content:deploy command.

php bin/magento cache:clean

php bin/magento cache:flush

 

 

if issue solved,Click Kudos & Accept as Solution

Re: magento CSS files not loading with https url

Hi, Thanks for the detailed instructions. so i had to maunally delete the files from static and page cache. i am kind of cautious about deleting the generated folder. are you sure it's safe and necessary? should i back up the files?

Thanks!

Re: magento CSS files not loading with https url

Yes I am sure , you can delete generated folder without taking any backup.

 

Actually its automatically created again , when you run php bin/magento setup:di:compile command.

 

So you can proceed for the same. basically in generated folder its generates compiled files and factory classes and all which generate automatically every time when you run compile command.

if issue solved,Click Kudos & Accept as Solution

Re: magento CSS files not loading with https url

i followed all your instructions and got an 500 error.

than i run php bin/magento setup:di:compile  and website is up again with the same css errors

 

Re: magento CSS files not loading with https url

Have you tried all my solutions ?

 

also could you please confirm ? in your core_config_table -  you have added web/unsecure/base_url = https://www.deals4u.co.il/  And web/secure/base_url = https://www.deals4u.co.il/

 

Could you please confirm ?

if issue solved,Click Kudos & Accept as Solution

Re: magento CSS files not loading with https url

yes i tried all of them...

i can confirm both rows are https://www.deals4u.co.il/

Re: magento CSS files not loading with https url

I have checked the link and error at browser console.

 

Its still showing version number in the css url. so css and js are not find.

 

current url = https://www.deals4u.co.il/pub/static/version1519368512/frontend/Smartwave/porto_rtl/he_IL/css/styles...

 

Expected url = https://www.deals4u.co.il/pub/static/frontend/Smartwave/porto_rtl/he_IL/css/styles-m.css

 

You have still versioning enabled in your application.

 

could you please open your database , go to core_config_data table then find dev/static/sign  from path and confirm its value is 0 (zero) ?

if issue solved,Click Kudos & Accept as Solution

Re: magento CSS files not loading with https url

i dont have dev/static/sign in my database

query

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);

returns 

#1062 - Duplicate entry 'default-0-dev/static/sign' for key 'CORE_CONFIG_DATA_SCOPE_SCOPE_ID_PATH'

 

Re: magento CSS files not loading with https url

okay run below query :

 

INSERT INTO `core_config_data`(`path`, `value`) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE `value`=0

Also could you please confirm ReWrite Mode is enabled in your server ?

 

ReWrite mode must needs to be enabled !! 

if issue solved,Click Kudos & Accept as Solution