Question

Domain redirection problem in nginx

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


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.

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