Question

How do i change/make my IP address to redirect to the registered domain name within digital ocean

Hie, i have my website’s domain registered and hosted on digital ocean, now i’ve finished working on it via WordPress installed on the same hosting provider, but it somehow continues to redirect to the IP address url instead of domain name url (like sitename.com).

Any idea as to how i can solve this problem

your help is greatly appreciated in this matter


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Better to add in the Nginx config for faster redirect and security as taken from SlickStack (GitHub) below example

##################################
#### Server Block: Production ####
##################################

server {
    listen                 443 ssl http2;
    listen                 [::]:443 ssl http2;
    server_name            @SITE_DOMAIN;
	if ($http_host !~ "@SITE_DOMAIN") {
        	return 301            $scheme://@SITE_DOMAIN$request_uri;
    	}

Hello,

Indeed in most cases, this is due to incorrect Site and Home URLs. I would suggest the following:

  • Change your site and home URLs to your domain name. You can do that either directly via your database in the optioins table, or by adding the following to your wp-config.php file:
define('WP_HOME','https://your_domain.com');
define('WP_SITEURL','https://your_domain.com');
  • Clear your website cache in case that you are using any caching plugins
  • Check your Apache Vhost for any redirects
  • Check your .htaccess file for any redirects as well
  • Go through your plugins and make sure that there are no redirect plugins installed that could be causing the issue

Let me know how it goes! Regards, Bobby