Question

How do I change my WordPress admin log URL from ip/wp-admin to domain.com/wp-admin?

I’ve set up Wordpress in a Digital Ocen droplet.

I’m trying set up an SMTP WordPress plugin in order to send emails via Gmail. Specifically, I’m trying to set up

https://wordpress.org/plugins/gmail-smtp/

and I’m following this guide

http://www.wpbeginner.com/plugins/how-to-send-email-in-wordpress-using-the-gmail-smtp-server/

When I navigate in my browser to www.domain.com I go to my site, and the URL in the browser shows as www.domain.com.

However, when I then navigate to the wp-admin (www.domain.com/wp-admin) and log in, the URL in the browser gets changed to IP address/wp-admin.

Then when I set up the plugin and “Create a new web application and set its Authorised Redirect URL to the one shown on this page” (the first step in the process) I get the following error message in Google

Invalid Redirect: http://IP Address/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant must end with a public top-level domain (such as .com or .org).

If anyone has a good idea on how to change my WordPress wp-admin log in URL to show my domain name instead would be much appreciated.

Many thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

What is your WordPress and Home URL? Both should match your domain and you can check it by logging in to WP Admin, going to Settings -> General. There you can find both Home and WordPress url.

Hello there,

You can start by updating the HOME and SITE_URL in the General settings of the WordPress admin area. However, there might be a lot more references for the IP address in the site’s database in which case you will need to use a search and replace tool to update all those to the site’s domain name.

First, I’ll suggest checking this article here provided by WordPress themselves:

https://wordpress.org/support/article/changing-the-site-url/

In there they’ll provide information on how you can change your Home and Site URL.

If you updated the Home and Site URLs from the WordPress admin panel and you still can’t open the website with your new domain, then you can take the next step and update all the references for the Old Domain in your database as well.

Note: Please before you proceed take a snapshot of the droplet and also create a backup of the site (both files and database). This will ensure that if something goes wrong you can easily restore your site or droplet if needed

There are a few ways to update the references in your database and it’s totally up to you which one you’ll choose. You can either change them manually if they’re not many or use an automation tool like a plugin or an external app.

One of the external apps that I’ve used and I know for sure that it’s working okay is: https://interconnectit.com/products/search-and-replace-for-wordpress-

You need to upload the script in your public_html folder and access it in your browser, then you’ll need to fill in your database details and enter the old domain name and the domain name you want to use. Then you can first use the dry-run option and if there are references that need to be updated you can then run the script and update them.

Also, an alternative way is to use a plugin called “Duplicator” it will update all of the paths and references from the dev domain to the main domain. This is why we usually recommend using a plugin called: Duplicator. The plugin will generate a backup for your website’s files and database. Then when you import the files to the new domain, all of the references for the old domain name will be updated properly with the correct ones.

Another option is to use the All-in-One WP Migration plugin. The plugin will do the replacement for you during import. You do not need to use any additional database search and replace

https://wordpress.org/plugins/all-in-one-wp-migration/

Hope that this helps!

Hello hugoelliott:

What are the URL of your WordPress site and home page? The two should match your domain name. You can verify this by logging into your WordPress admin dashboard and going to Settings -> General. There you will see both the homepage and WordPress URL.

Thank you xMudrii - this worked perfectly!

I can’t believe I overlooked something so simple…