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


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


 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

  • what should I give instead of example.. I am running on a local xampp server – learner Jul 3 '17 at 10:17
  • usually my store address is localhost/magento-2 and my admin address is localhost/magento-2/admin111 – learner Jul 3 '17 at 10:17
  • Your need to give localhost/magento-2 instead of example.com. – Rajkumar .E Jul 3 '17 at 10:24
  • or its goes 404, then you need to give FQDN name instead of localhost/magento-2 like localhost-magent-2 – Rajkumar .E Jul 3 '17 at 10:33
  • hurrah..!! page redirected correctly!! BUT..BUT.. contents are not listing properly. they all are unaligned..!! I think css are not rendering but admin panel is properly rendering.! – learner Jul 3 '17 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.