When setting up Magento to work with a CDN via native support, you need to be careful that you enter the correct CDN URL in proper fields.
In case you accidentally insert the wrong URL, URLs without http(s)://
or the correct URL in a wrong section (HTTPS URL into an HTTP field), you can easily break your website since Magento will not be able to populate pages using the wrong CDN URL.
As long as you did not choose the option to apply the CDN URL to admin area files, this can be easily fixed in the Magento control panel. However in most cases the CDL URL is applied to the admin area, and so the mistake cannot be fixed inside Magento.
How To Resolve
This can only be fixed by going into the Magento database and making manual changes in the table → core_config_data
:
Resolving in PhpMyAdmin
If you are using shared or managed web hosing services, you may need to ask your hosting provider if they offer access to PhPMyAdmin
- Log into PhpMyAdmin.
- Select your database from left side menu.
- Click the Search tab on the top of the page.
- In search phrase type the wrong URL you added, select
core_config_data
from the Inside tables menu and click Go. - After you get search result just replace wrong url(s) with correct and after you hit enter changes will be saved
Unsecure Section Example:
- Wrong URL
web/unsecure/base_url http://domain.com/ web/unsecure/base_link_url {{unsecure_base_url}} web/unsecure/base_skin_url http://wrong.url.netdna-cdn.com/skin/ web/unsecure/base_media_url http://wrong.url.netdna-cdn.com/media/ web/unsecure/base_js_url http://wrong.url.netdna-cdn.com/js/
- Correct URL
web/unsecure/base_url http://domain.com/ web/unsecure/base_link_url {{unsecure_base_url}} web/unsecure/base_skin_url http://foo.bar.netdna-cdn.com/skin/ web/unsecure/base_media_url http://foo.bar.netdna-cdn.com/media/ web/unsecure/base_js_url http://foo.bar.netdna-cdn.com/js/
Secure Section Example:
- Wrong URL
web/secure/base_url https://domain.com/ web/secure/base_link_url {{secure_base_url}} web/secure/base_skin_url https://wrong.url.netdna-cdn.com/skin/ web/secure/base_media_url https://wrong.url.netdna-cdn.com/media/ web/secure/base_js_url https://wrong.url.netdna-cdn.com/js/
- Corrected
web/secure/base_url https://domain.com/ web/secure/base_link_url {{secure_base_url}} web/secure/base_skin_url https://foo.bar.netdna-cdn.com/skin/ web/secure/base_media_url https://foo.bar.netdna-cdn.com/media/ web/secure/base_js_url https://foo.bar.netdna-cdn.com/js/
Reload your Magento website and it should be now loading properly.
SSH/terminal access
You can also achieve this by editing the MySQL Database from within Linux.
If you are using shared or managed web hosing services, you may need to as your hosting provider for your specific MySQL database account login details, or to check your Magento configuration file for you.
- Create a backup of your database:
mysqldump -u [user] -h [server] -p [db_name] > [backup_file].sql
- Log into your database server:
mysql -u [user] -h [server] -p [db_name]
- Update the wrong URL value with correct URL:
update core_config_data set value = ‘http://foo.bar.netdna-cdn.com’ where value = ‘wrong.url.netdna-cdn.com
← depending on whether you need to alter the HTTPS or HTTP value. - Reload your Magento website and it should be now loading properly.
We hope this article was helpful. As always, If you have any questions or concerns about any of the topics mentioned in this article, please feel free to reach out to support - we are available 24/7 by chat or email!