Magento Tutorials

How to Change Base URLs in Magento 1 & 2

Each website in a Magento installation has a Base URL that is assigned to the frontend and to the Admin.

If you have a security certificate for your domain, you can configure each or both base URLs to operate over a securely encrypted SSL channel. Unsecure base URLs begin with “http,” and secure base URLs begin with “https.”

In case you want to change your Magento site Base URLs, you can apply one of these below methods.

In Magento backend

Magento 1

  • Configure the unsecure base URLs:
Magento unsecure base url
  1. In your Magento backend, go to System > Configuration.
  2. On the left menu, under General section, click Web.
  3. Expand Unsecure section. Enter the unsecure (http) Base URL for your store. Make sure to end the URL with a forward slash (“/”).
  4. (Optional) If you don’t plan to use a secure base URL for the Admin, do the following:
    a. Expand Secure section.
    b. Enter your unsecure (http) Base URL. The URL should be the same in both the Secure and Unsecure sections.
  5. Click the Save Config button.
  • Configure the secure base URLs:

If your domain has a valid security certificate, you can configure the URLs for either the frontend and Admin—or both—to run over a secure (https) channel.

Magento Base URL
  1. In your Magento backend, go to System > Configuration.
  2. On the left menu, under General section, click Web.
  3. Expand Secure section. Then, do the following:
    • To use a secure (https) for the frontend, enter the Base URL, followed by a forward slash (“/”).
    • If you want to run the entire storefront over a secure (https) channel, set Use Secure URLs in Frontend to Yes.
    • If you want to run the entire Admin over a secure (https) channel, set Use Secure URLs in Admin to Yes.
  4. Click the Save Config button.

Magento 2

  • Configure the unsecure base URLs:
  1. In your Magento 2 backend, go to Stores > Settings > Configuration.
  2. On the left menu, under General section, click Web.
  3. Expand Base URLs section. Enter the unsecure (http) Base URL for your store. Make sure to end the URL with a forward slash (“/”).
  4. (Optional) If you don’t plan to use a secure base URL for the Admin, do the following:
    a. Expand Base URLs (Secure) section.
    b. Enter your unsecure (http) base URL into Secure Base URL field. The URL should be the same in both the Base URLs and Base URLs (Secure) sections.
  5. Click the Save Config button.
  • Configure the secure base URLs:

If your domain has a valid security certificate, you can configure the URLs for either the storefront and Admin—or both—to run over a secure (https) channel.

Magento 2 Base URL
  1. In your Magento 2 backend, go to Stores > Settings > Configuration.
  2. On the left menu, under General section, click Web.
  3. Expand Base URLs (Secure) section. Then, do the following:
    • To use a secure (https) for the storefront, enter the Secure Base URL, followed by a forward slash (“/”).
    • If you want to run the entire storefront over a secure (https) channel, set Use Secure URLs on Storefront to Yes.
    • If you want to run the entire Admin over a secure (https) channel, set Use Secure URLs in Admin to Yes.
  4. Click the Save Config button.

Using command line

  1. Use SSH to log in to your Magento hosting server.
  2. Enter the following command:
    mysql -u $database_user -p $database_name
  3. Enter your password when prompted.
  4. Access the database using the following command, where database is the database name.
    use database
  5. Run the following command. This will display the current base_urls set in Magento.
    select * from core_config_data where path like '%base%url%';
  6. To change the base URLs, run the following commands:
update core_config_data set value = 'http://example.com/' where path = 'web/unsecure/base_url';
update core_config_data set value = 'https://example.com/' where path = 'web/secure/base_url';

Hope this helps!

For more actionable Magento tutorials like this, keep reading the Magento section on our Blog.


Further Reading:

How to Change Magento 2 Logo
A Completed Guide to Fix Magento Admin Login Not Working Issue
How to Generate and Submit Google Sitemap (.XML) for Your Magento 1 & 2 Store

Dom

A knowledge craver who always strive to be wiser everyday.