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.!
1 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
-
what should I give instead of example.. I am running on a local xampp server– learnerCommented Jul 3, 2017 at 10:17
-
usually my store address is localhost/magento-2 and my admin address is localhost/magento-2/admin111– learnerCommented Jul 3, 2017 at 10:17
-
Your need to give
localhost/magento-2
instead ofexample.com
. Commented Jul 3, 2017 at 10:24 -
or its goes 404, then you need to give FQDN name instead of
localhost/magento-2
likelocalhost-magent-2
Commented Jul 3, 2017 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.!– learnerCommented Jul 3, 2017 at 10:44