Report this

What is the reason for this report?

Domain redirection problem in nginx

Posted on March 11, 2021

When I am opening this domain:thecosmo.in in browser it redirecting to this domain:beardlovers.in (Check this screen short: http://prntscr.com/10in2fj , http://prntscr.com/10in3lm) I am using cloudflare. this domain(thecosmo.in) is added in cloudflare account.

THis is my domain configuration.

# Redirect_Host
server {
    listen 80;

    server_name www.thecosmo.in;
    return 301 http://thecosmo.in$request_uri;
}
# Main_Host
server {
    listen 80;
    listen [::]:80;
    
    index index.php index.htm index.html;
    server_name thecosmo.in;

    # root Directory
    root /srv/users/kwikservers/shankardevelopment.kwikfunnels.com/htdocs;
    
    # Wordpress - Handle PHP
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    
    # Handle PHP with Fast CGI
    location ~ \.php$
    {
        include /etc/nginx/snippets/fastcgi-php.conf;
        fastcgi_param   HTTP_PROXY      "";
        fastcgi_pass shankardevelopment.kwikfunnels.com;
    }
    
    # Logs
    access_log /srv/users/kwikservers/thecosmo.in/log/http.access.log; 
    error_log /srv/users/kwikservers/thecosmo.in/log/http.error.log; 
    
    # Website Config
    include /etc/nginx/sites-available/thecosmo.in.d/*.conf;
}

Can you help me pls. What’s doing wrong? Thanks in advance



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!

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.

Hi there,

The Nginx configuration looks correct.

Is the other website also hosted on the same server?

I could suggest a few things:

  • Make sure that there are no references for the other domain name in your database, for example, if you are using WordPress, make sure that the site and home URLs are set correctly.

  • Make sure that your domain:thecosmo.in has an active SSL so that in case anyone tries to access the site over HTTPS it would load as normal rather than being redirected to the first site with SSL certificate on the same server

Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.