Magento2 404 Error – Fix After Changing Base URL to Non-Existing Site

magento-2.1.3magento2

I am learning Magento2 and tried creating a store view through admin panel and changed the base URL to a non existing site. now after save config I don't able to access the admin panel or my site.?? 404 error occurs.! How to change my base URL to default site's base URL using command line and revert the changes that I have made.? thank you in advance! please help me.!

Best Answer

You want to change base URL using Commmand line, Run below command

php bin/magento setup:store-config:set --base-url="http://example.com/"

php bin/magento setup:store-config:set --base-url-secure="https://example.com/"

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:clean

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

Related Topic