Zethson / igem_tuebingen_website

igem-tuebingen.com
MIT License
5 stars 3 forks source link

Redirect www.igem-tuebingen.com to igem-tuebingen.com/index #69

Open Zethson opened 5 years ago

Zethson commented 5 years ago

https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7

Else, users may land in the server config

image

Zethson commented 5 years ago

@Imipenem What do you think is the easiest method? Simply redirecting any www request to an https equivalent without www?

Imipenem commented 5 years ago

Yes, easiest way would be probably to state in the nginx/sites-enabled/igem_tuebingen_website file, that every request for igem-tuebingen.com/www.igem-tuebingen.com should be answered by an https (redirect) request.

`server { if ($host = igem-tuebingen.com) { return 301 https://$host$request_uri; } # managed by Certbot

if ($host = www.igem-tuebingen.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot

listen 80; server_name www.igem-tuebingen.com igem-tuebingen.com; return 301 https://$host$request_uri; }`

Something like this should do the job.

Zethson commented 5 years ago

This might also help with redirecting any traffic to the https version.

This is another issue.

Zethson commented 5 years ago

Unfortunately this solely solves https redirecting, but not the issue described above.