cancel
Showing results for 
Search instead for 
Did you mean: 

Page 404 not found After changing Base URL

Page 404 not found After changing Base URL

Hi, I have changed the base URL accidentally and the page shows 404 Not Found now. Is there have anyway to fix it or change it back? Thank you!!!

5 REPLIES 5

Re: Page 404 not found After changing Base URL

Hello @alyssa _sager

 

Run below command :

php bin/magento cache:clean

 

update:

remove all content<magento-root-dir>/var*

 

Then run below command: remove all content(not remove .htaccess)/pub/static/* Then run below command:

 

php bin/magento setup:static-content:deploy
php bin/magento cache:flush

 

Then check it, if you have any issue let me know

 

-----------------------------------------

If issue solved, Click Kudos & Accept as Solution

 

 

 

Re: Page 404 not found After changing Base URL

Hello @alyssa _sager

 

Please follow below steps

  1. Go to phpmyadmin
  2. Select database
  3. Open core_config_data table
  4. Find web/unsecure/base_url and web/secure/base_url value in path column and set your domain value in value column with backslash check below screenshot
    https://www.screencast.com/t/nLaU3hBwjPdg
    2018-10-25_10-58-58.jpg
  5. Clear cache by rename var directory in magento root.
  6. Done.

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Page 404 not found After changing Base URL

Hi @alyssa _sager

 

Yes - if you have changed base_url accidentally then there is no issue - you can change Base Url from the database.

 

go to your database if you have PHPMYADMIN installed then it would be much helpful to you otherwise you can access your database using mysql as well.

 

open core_config_data table and find base_url  - then change it from there.

 

After that run - php bin/magento indexer:reindex command

clear the cache - php bin/magento cache:clush

 

 

Hope it helps !

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Page 404 not found After changing Base URL

@alyssa _sager

 

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:

  1. Set Unsecure URL

    bin/magento setup:store-config:set --base-url="http://www.magento2.com/"
  2. Set Secure URL

    bin/magento setup:store-config:set --base-url-secure="https://www.magento2.com/"
  3. Clear Cache

    bin/magento cache:flush

 

OR using PHPMYADMIN:

 

  1. Open your core_config_data table in phpMyAdmin.

  2. 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/
  1. 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.

  2. 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/
  1. 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

  2. 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.

Manish Mittal
https://www.manishmittal.com/

Re: Page 404 not found After changing Base URL

Hi @alyssa _sager,

 

Which version of Magento are you using?

You've got several answers for different versions and ways to solve the issue.

Can you please provide more information about your Magento's version?

Also, can you access to your Magento's backend to change values?

If not, is it possible for you to edit data into the database?