- I changed Base Urls and now my website is inaccessible
- I moved everything to a new server, didn't change the base_url and my website is inaccessible
How do I change or restore base_url my BaseURL settings?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communitySymptom: I changed Base Urls and now my website is inaccessible or I moved everything to a new server, didn't change the base_url
and my website is inaccessible.
Instructions are for a simple "one store" website where the "default store view" is set to inherit its setup from the "default config". There will be an additional instance of the below mentioned table rows for each unchecked Use Website
checkbox.
Open your core_config_data
table in phpMyAdmin.
Sort table by path
column and find the following rows for your unsecure section, they should look like the following:
Columns
PATH VALUE
web/unsecure/base_url http://www.example.com/
web/unsecure/base_link_url {{unsecure_base_url}}
web/unsecure/base_skin_url {{unsecure_base_url}}skin/
web/unsecure/base_media_url {{unsecure_base_url}}media/
web/unsecure/base_js_url {{unsecure_base_url}}js/
Replace http://www.example.com/
with your appropriate domain url (trailing slash necessary) and if you’ve installed in a subfolder append it with a /
after it.
Find the following rows for your secure section, they should look like the following:
Columns
PATH VALUE
web/secure/base_url https://www.example.com/
web/secure/base_link_url {{secure_base_url}}
web/secure/base_skin_url {{secure_base_url}}skin/
web/secure/base_media_url {{secure_base_url}}media/
web/secure/base_js_url {{secure_base_url}}js/
Replace https://www.example.com/
with your appropriate domain url (trailing slash necessary) and if you've installed in a subfolder append it with a /
after it. If you haven't received your security certificate and enabled TLS/SSL yet, use http
instead of https
Clear contents from var/cache
, var/session
directories after changing base_urls
.
Clearing cache and sessions is necessary because your config is cached and clearing it forces a reread of the configuration data from the core_config_data
table and reestablishment of sessions with the proper information.
NOTE: If you have set your base_url
correctly for web/unsecure/base_url
and web/secure/base_url
you do not have to mess around with changing the {{UNSECURE_BASE_URL}}
and {{SECURE_BASE_URL}}
macros in the rest of the entries.
mysql -u $USER -p $DBASE
http://www.example.com/
and secure https://www.example.com/
(if you have SSL/TLS enabled, else https should be http) with your appropriate domain url (trailing slash necessary) and if you’ve installed in a subfolder append it with a /
after it.SQL Commands
UPDATE core_config_data SET value = 'http://www.example.com/' WHERE path LIKE 'web/unsecure/base_url';
UPDATE core_config_data SET value = 'https://www.example.com/' WHERE path LIKE 'web/secure/base_url';
SQL Commands
SELECT path,value FROM core_config_data WHERE path LIKE 'web/unsecure/base%';
SELECT path,value FROM core_config_data WHERE path LIKE 'web/secure/base%';
var/cache
, var/session
directories after changing base_urls
. Clearing cache and sessions is necessary because your config is cached and clearing it forces a reread of the configuration data from the core_config_data
table and reestablishment of sessions with the proper information.var/
directory are messed up, Magento will store the Magento cache in the system /tmp
directory as documented here and clearing the cache doesn't clear the cached config entries pulled from core_config_data
until server reboot or someone with sufficient rights can delete Magento's mislaid cache.
Jul 28, 2015 at 0:33
n98-magerun
, use the command n98-magerun.phar sys:info
to get a basic system info listing with one item being Cache Directory
location.
Jan 28, 2016 at 2:19
php bin/magento cache:flush
. I will add that if you have a multisite setup as we do, you will want to be specific with the config_id you target and make sure to update for all sites.
web/cookie/cookie_domain
Jun 27, 2022 at 13:04
In Magento2, there is also a way to do this directly via Magento using below commands rather than having to go through SQL which i find a bit quicker.
Within Magento’s root directory run below commands:
Set Unsecure URL
bin/magento setup:store-config:set --base-url="http://www.magento2.com/"
Set Secure URL
bin/magento setup:store-config:set --base-url-secure="https://www.magento2.com/"
Clear Cache
bin/magento cache:flush