# Installed discourse on a server that already runs a webserver, domain just redirects to subdomain

**URL:** https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645
**Category:** Self-hosting
**Created:** [27 januari 2019 om 13:48 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645 "2019-01-27T13:48:57Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 13:48 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/1 "2019-01-27T13:48:57Z")

</div>

Hi!  
I just set up discourse and then followed [this guide](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247).  
My subdomain for the forum is [forum.example.com](http://forum.example.com).

### However, when I go to [example.com](http://example.com), I just get redirected to [forum.example.com](http://forum.example.com)

Here is my Namecheap DNS setting:

 ![Capture](https://global.discourse-cdn.com/meta/original/3X/6/1/616b100c64312c8dec6f0dc14cf72abfe18f7cc7.png)

This is my **outer** nginx config:

wordpress.conf (my main site):

```plaintext
server {
  listen 80;
  #listen 443 default ssl;

  server_name snapecraft.net;
  root /var/www/html;

  #ssl_certificate /etc/nginx/ssl/mydomain.crt;
  #ssl_certificate_key /etc/nginx/ssl/mydomain.key;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log error;

  index index.php index.phtml index.html;

  location / {
        try_files $uri $uri/ /index.php?$args;
        if (-f /var/ErrorPages/maintenance.html) {
            return 400;
        }
        # add one directive for each http status code
        error_page 400 /ErrorPages/maintenance.html;
        error_page 404 /ErrorPages/404.html;
        error_page 503 /ErrorPages/503.html;
    }

    # redirect the virtual ErrorPages path the real path
    location /ErrorPages/ {
        alias /var/ErrorPages/;
        internal;
    }

# location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
 # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  # fastcgi_intercept_errors on;
  # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 # include /etc/nginx/fastcgi_params;
#
# }

    location ~ [^/]\.php(/|$) {
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_intercept_errors on;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi_params;

  }

}

```

discourse.conf (Config for the forum):

```plaintext
server {
    listen 80; listen [::]:80;
    server_name forum.snapecraft.net; # <-- change this

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2; listen [::]:443 ssl http2;
    server_name forum.snapecraft.net; # <-- change this

    ssl on;
    ssl_certificate /var/discourse/shared/standalone/ssl/forum.snapecraft.net.cer;
    ssl_certificate_key /var/discourse/shared/standalone/ssl/forum.snapecraft.net.key;
    ssl_dhparam /var/discourse/shared/standalone/ssl/dhparams.pem;
    ssl_session_tickets off;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;

    http2_idle_timeout 5m; # up from 3m default

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

```

Thanks a bunch in advance! Any help is highly appreciated!

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 januari 2019 om 15:21 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/2 "2019-01-27T15:21:27Z")

</div>

What I can guess is that there is something wrong with your wordpress configuration (It looks very customized with those error pages etc.)

while trying to access your wordpress, I get

> The page isn’t redirecting properly
> 
> Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
> 
> ```
> This problem can sometimes be caused by disabling or refusing to accept cookies
> 
> ```

Page location is [http://snapecraft.net/en/home-2/](http://snapecraft.net/en/home-2/)

This is what I get when I try to curl that link:

> curl -I [http://snapecraft.net/en/home-2/](http://snapecraft.net/en/home-2/)  
> HTTP/1.1 301 Moved Permanently  
> Server: nginx/1.15.8  
> Date: Sun, 27 Jan 2019 15:22:11 GMT  
> Content-Type: text/html; charset=UTF-8  
> Connection: keep-alive  
> Set-Cookie: pll\_language=en; expires=Mon, 27-Jan-2020 15:22:11 GMT; Max-Age=31536000; path=/  
> Location: [http://snapecraft.net/home-2/](http://snapecraft.net/home-2/)

forum loads fine.

Any chance your primary site is running without ssl as well?

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:25 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/3 "2019-01-27T15:25:06Z")

</div>

Yes, my wordpress site is running without SSL.  
My website is bi-lingual (German & English) and detects your browser’s language. The german wordpress site works fine after clearing the cache.  
Just the english page doesn’t work what is kind of weird. Do you know what is the issue?

When we’re at it, how would that SSL transition work?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 januari 2019 om 15:25 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/4 "2019-01-27T15:25:45Z")

</div>

This is the redirection loop that your site is stuck in.

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/1/a1e7dd95ad7af782d7ffd600bab6c9c28f859458.png)

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:27 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/5 "2019-01-27T15:27:22Z")

</div>

Ok, this is weird.

I just bought the domain and previously we had this domain: snapecraft. **ddns**.net

I changed the domain in wp-config and used a plugin.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 januari 2019 om 15:30 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/6 "2019-01-27T15:30:15Z")

</div>

> [@MayusYT](#):
>
> used a plugin

Which Plugin? can you try disabling it for diagnostics?

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:30 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/7 "2019-01-27T15:30:53Z")

</div>

It’s called ‘DB Migrate’

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:31 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/8 "2019-01-27T15:31:33Z")

</div>

So I guess the old domain still remains in certain parts of the DB

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:32 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/9 "2019-01-27T15:32:36Z")

</div>

My multi-Language plugin is called ‘PolyLang’

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 januari 2019 om 15:34 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/10 "2019-01-27T15:34:36Z")

</div>

I can’t help you much with wordpress here,  
You can maybe try disabling all the plugins in wordpress (by moving them out of the /wp-contents/plugin folder) and then trying to see if it fixes it? or maybe hire someone to fix your wordpress.

---

<div class="post-metadata">

### Author: ![MayusYT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayusyt/32/154210_2.png) [@MayusYT](https://meta.discourse.org/u/MayusYT)
#### Post date: [27 januari 2019 om 15:34 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/11 "2019-01-27T15:34:36Z")

</div>

Nevermind, I just had to change the polylang settings 😃  
Thank you very much for your help!

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 januari 2019 om 15:35 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/12 "2019-01-27T15:35:12Z")

</div>

Glad to hear your issue is fixed 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [26 februari 2019 om 15:35 UTC](https://meta.discourse.org/t/installed-discourse-on-a-server-that-already-runs-a-webserver-domain-just-redirects-to-subdomain/107645/13 "2019-02-26T15:35:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
