Once the installation is completed, is there a posibility to change admin url? If yes how can I do that?
Change Admin Path
It is not recommended to change it directly from
app/etc/env.php, always prefer the CLI:
php bin/magento setup:config:set --backend-frontname="admin_path"
Do not add the first
/ in the
admin_path as it will result in an invalid parameter exception.
Change Admin URL
This can be done via the admin under Store > Advanced Tab > Admin Base URL section
One of coolest solution:
Goto magento >admin>Store>Advance>Admin Base Url>
Use Custom Admin URL field change value =YES
Then make Custom Admin URL as per as wise:
Note that: Make sure that base URL ends with '/' (slash), e.g. http://yourdomain/magento/
This will use If you want to change admin full url
If you want to change admin path then
Use Custom Admin Path =Yes and make
Custom Admin Path as per as your wise
you can change admin url using,
Change frontName equal to your required value,
'backend' => array ( 'frontName' => 'admin', //keep your custom url name here )
After changes your url, you must remove your var folder from root.
Now your admin url is like ,
In Case You Cannot Access The Admin
If like me you could not access the admin in order to make the required change then on top of Amit Bera's answer, you will need to add a
core_config_data configuration with the path:
INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`) VALUES( 'default', # Or whatever your Scope is 0, # Or whatever your Scope ID is 'admin/url/use_custom', 1 ); INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`) VALUES( 'default', # Or whatever your Scope is 0, # Or whatever your Scope ID is 'admin/url/custom', 'https://my.url.com/newadminpath/' );
Then run the CLI command:
php bin/magento setup:config:set --backend-frontname="newadminpath" php bin/magento maintenance:enable php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento maintenance:disable
Quick answer (Using Magento 2 Admin settings):
- Log in the Magento 2 Admin interface
- Click Stores
- Click Configurations
- In the panel on the left, under Advanced, click Admin and expand the Admin Base URL section Set Use Custom Admin Path to “Yes”.
- Enter the Custom Admin Path. The path that you enter is appended to the
- Custom Admin URL after the last forward slash. For example:
- You will be logged out and redirected to the new Admin URL
Quick answer (Using CLI):
php bin/magento setup:config:set --backend-frontname="newadminpath"
newadminpath is the new Magento 2 Admin URL
You need to follow below steps to change admin url
- Go to app/etc/env.php and find 'frontName' and change that value
if your current admin url is www.yourdomain.com/admin then frontName value will be admin ('frontName' => 'admin' ) you need to change admin with your new word
- Run commands: static-content, reindex, cacha clean flush, di compilation
There are multiple ways to change the Admin URL in Magento 2.
Go to app/etc directory from the root directory of your store and open the env.php file in the text editor. Then change the frontName according to your choice:
return array ( 'backend' => array ( 'frontName' => 'magento', )
Lastly, run these commands:
rm -rf var/cache/* php bin/magento cache:clean php bin/magento cache:flush
You can also change it, via command line or through Admin Panel.