cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4 custom admin url adding cause admin page error and can't log in.

Highlighted

Magento 2.4 custom admin url adding cause admin page error and can't log in.

Hi,

  I'm having this very issue with fresh installation of magento 2.4, I can change the web url fine let say from " http://117.xxx.100.xxx" to "http://mydomain.com/  " and save, the new link " http://mydomain.com" works fine, however as soon I change 

custom admin url to yes 

admin url to "http://mydomain.com/magento/ " and save config  Magento kicks me out and bring the error page.

 

I followed all the instructions on Magento site but no solution, luckily I have a server back up that I restored to the initial situation just before adding the admin custom url, however trying all the solutions including editing the database doesn't solve the situation.

any assistance will be greatly appreciated, I'm first time user of Magento.

 

 

7 REPLIES 7
Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

Hello @salnexmgma910c 

 

You can change admin path from three ways :

 

1. You can change your admin path after domain by below command :

php bin/magento setup:config:set --backend-frontname="admin_path"

admin_path will append after the domain http://www.domain.com/admin_path

 

2. also you can manually change in file :

app/etc/env.php

 

change the admin frontname.

 

3. From the admin you can change the URL of admin which includes the domain as well by changing custom admin URL but in your case you just want to change the slug after domain.

so just change Use Custom Admin Path to yes, and add your Slug (Ex: admin_path).

 

Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution to encourage to write more answers !
Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

dear gaurav_harsh1,

  I did do that however the admin page comes up with "whoppse our mistake error page " so I decided to keep the random generated one like "mydomain.com/admin_5tg4vs"

no matter what I do I can't  get in in the custom url version, now after trying to apply ssl with lets cert I got the padlock on storefront but admin page comes with error message in firefox

"The page isn’t redirecting properly" this magento 2.4 is very time consuming.

 

Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

@salnexmgma910c 

 

Please check your base URL by below command :

php bin/magento config:show web/unsecure/base_url

and

php bin/magento config:show web/secure/base_url

The secure URL should be like "https://YOUR_DOMAIN/"

and the unsecure URL should be like "http://YOUR_DOMAIN/"

 

if it's incorrect you can update it by :

php bin/magento config:set web/secure/base_url https://NEW_DOMAIN/

and

php bin/magento config:set web/unsecure/base_url http://NEW_DOMAIN/

both must end with a "/"

 

Well, you can simple change the text in app/etc/env.php and change the backend->frontName it will surely work for you ! 

Problem Solved ? Click on 'Kudos' & Accept as Solution to encourage to write more answers !
Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

Dear gaurav_harsh1

I'm following exactly the instructions on Magento Guide, however I loose the admin page as soon as I click save config.

see the Magento instructions guide here

Method 1: Change from the Magento Admin
On the Admin sidebar, go to Stores > Settings > Configuration.

In the left panel, expand Advanced and choose Admin.

Expand Expansion selector the Admin Base URL section.

Set the configuration options for the custom URL:

Advanced configuration - Admin base URL
Admin Base URL

If needed, clear the Use system value checkbox to change the setting.

Set Use Custom Admin URL to Yes.

Enter the Custom Admin URL: in this case I use  "http://mydomain.com/magento/"

The Admin URL must be in the same Magento installation, and have the same document root as the storefront.
Set 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.

in this case I used myname so the the admin should be 

"http://mydomain.com/magento/myname " according to this guide

When complete, click Save Config.

After the changes are saved, Sign Out of the Admin. Then, log back in using the new Admin URL and path.

 

however as soon i click save config I get this message 

Whoops, our bad... 

I have tried to change the env.php file  however I get the admin page as a tesxt field with no 2FA option to log in after typning user name and password. this is even before applying ssl to so everytime I try it fails so I have to restore the server again.

only one thing I want to mention is when I change the webstore url  under store-configuration-web,   I add an s after http under secure url, because by default it is " http://mydomain.com "

so the webstore url is" http://mydomain.com  "and the secure Url becomes "https://mydomain.com " but at this stage when I save config it kicks me out but I comeback to"  http://mydomain.com/admin...   'and log in fine but the admin url change is making me loose the admin page.

also when run php bin/magento info:adminuri  it is showing below

/admin_5tg4vs

Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

@salnexmgma910c 

 

As I shared in my first comment, please change Use Custom Admin URL to NO, you just want to change the slug after your domain, so just set Use Custom Admin Path to YES that's only thing you need to do.

 

and at path place, just add one keyword, admin won't work with "magento/myname "

the admin slug should be one keyword without any "/".

 

Skip using Use Custom Admin URL and try other ways I shared.

Problem Solved ? Click on 'Kudos' & Accept as Solution to encourage to write more answers !
Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

 

I have just fixed this issue after many trails and errors, the mistake I was making is in the instructions itself.

Enter the Custom Admin URL: "http://yourdomain.com/magento/"

The Admin URL must be in the same Magento installation, and have the same document root as the storefront.

so my Magento files are in the root of the public_html folder and I was adding the custom admin URL as "http://mydomain.com/magento " and it should only be " http://mydomain.com/ "

because the Magento installation is in the public_html and not inside another directory called Magento.

Thank you for your assistance and hope this will help many others in similar situation.

 

 

Highlighted

Re: Magento 2.4 custom admin url adding cause admin page error and can't log in.

Thank you for reply, the problem I'm having now is with ssl cert installation, as soon as I successfully install SSL cert on the server, the admin page and site shows text content for some reason, and can't log in, this is after going to store-config-web and select yes for all 4 option to use secure url in store fron and admin page.