cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 admin css and js not loading after trying to change admin URL

SOLVED

Magento 2 admin css and js not loading after trying to change admin URL

To change my admin_url of Magento i did it first with: Store > Advanced Tab > Admin Base URL section

After that the admin css and js wasn't working and to solve that i tried it with the command in SSH:

php bin/magento setup:config:set --backend-frontname="admin_path"

now still no js and css is loading in admin. I tried the commands below to solve but there's still no css and JS in admin, in frontend everything is working:

-> php bin/magento cache:flush -> php bin/magento setup:upgrade -> php bin/magento setup:static-content:deploy -f -> php bin/magento setup:static-content:deploy -f nl_NL - Removing static files except .htaccess - Reindexing Changing the following content:

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink To:

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy


Can anyone help? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

Hello @muhammet_yilmaz 

 

1106	stores	0	web/secure/base_url	https://www.startshop.nl/admin_secret/
1107	stores	0	web/unsecure/base_url	https://www.startshop.nl/admin_secret/

this two entry wrong, no need to enter admin key into url, it will manage via custom_admin url or env.php 


it should be

 

1106	stores	0	web/secure/base_url	https://www.startshop.nl/
1107	stores	0	web/unsecure/base_url	https://www.startshop.nl/

now go to app/etc/env.php

 

and check 

 

'backend' =>
array (
'frontName' => 'admin_1ncc4d',
),

 

you need to mention admin url there.

 

then do cache flush and check it.

 

If works then mark as the solution.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

12 REPLIES 12

Re: Magento 2 admin css and js not loading after trying to change admin URL

Hello @muhammet_yilmaz 

 

just run php bin/magento c:c

 

and also check is version added into css load.

 

static/version1556609988/frontend//base/en_US/mage/calendar.css
try to open without version and check it

 

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 admin css and js not loading after trying to change admin URL

Hi.


In the source file of the page i see that it's trying to call the css and js files from

https://www.Domain.nl/admin_secret/pub/static/adminhtml/Magento/backend/nl_NL/extjs/resources/css/ex...

if i try to open this link so without admin_secret in the url it opens the css file correc:

Re: Magento 2 admin css and js not loading after trying to change admin URL

Hello @muhammet_yilmaz 

 

i think you entered wrong admin url.

 

seems like you added url with admin_secret.

 

check all URL, is there any url contain admin_secret?

 

if works then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 admin css and js not loading after trying to change admin URL

Hi Sunil,

 

Yes in the source file of admin page, the code is calling all url's with admin_secret for css and js files, but this isn't working. When i copy the url's example a css URL and test without admin_secret it's working. so i think something need to be changed to not call the css and js files from /admin_secret/

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

@muhammet_yilmaz 

 

can you please run below query into db

 

select * from core_config_data where path like '%url%';

 

and post your result here

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

please check

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

Hello @muhammet_yilmaz 

 

i can not able to see that screenshot

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

default	0	web/unsecure/base_url	http://www.DOMAIN.nl/	
3	default	0	web/secure/base_url	https://www.DOMAIN.nl/
41	default	0	web/unsecure/base_static_url	NULL
42	default	0	web/unsecure/base_media_url	NULL
43	default	0	web/secure/base_static_url	NULL
44	default	0	web/secure/base_media_url	NULL
438	default	0	web/url/use_store	0
447	default	0	connector_dynamic_content/external_dynamic_content...	cLHLJSX8CURtOTvzcvxq8e0Rmwaa1PBT
487	default	0	rokanthemesbrand/general_settings/url_prefix	brand
488	default	0	rokanthemesbrand/general_settings/url_suffix	.html
651	default	0	payment/braintree/descriptor_url	NULL
861	default	0	web/unsecure/base_link_url	http://www.DOMAIN.nl/
862	default	0	web/secure/base_link_url	https://www.DOMAIN.nl/
926	default	0	magmodules_googleshopping/advanced/url_utm	NULL
1104	default	0	admin/url/use_custom	0
1105	default	0	admin/url/custom	
1106	stores	0	web/secure/base_url	https://www.DOMAIN.nl/admin_secret/
1107	stores	0	web/unsecure/base_url	https://www.DOMAIN.nl/admin_secret/
1108	default	0	admin/url/use_custom_path	0

Re: Magento 2 admin css and js Henot loading after trying to change admin URL

Hello @muhammet_yilmaz 

 

1106	stores	0	web/secure/base_url	https://www.startshop.nl/admin_secret/
1107	stores	0	web/unsecure/base_url	https://www.startshop.nl/admin_secret/

this two entry wrong, no need to enter admin key into url, it will manage via custom_admin url or env.php 


it should be

 

1106	stores	0	web/secure/base_url	https://www.startshop.nl/
1107	stores	0	web/unsecure/base_url	https://www.startshop.nl/

now go to app/etc/env.php

 

and check 

 

'backend' =>
array (
'frontName' => 'admin_1ncc4d',
),

 

you need to mention admin url there.

 

then do cache flush and check it.

 

If works then mark as the solution.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post