Question

Domain redirection problem in nginx

Posted March 11, 2021 53 views
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

edited by MattIPv4

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
1 answer

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