Question

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

Posted May 19, 2021 162 views
WordPress

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

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.

×
Submit an Answer
2 answers

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

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;
        }