How to configure www.site.com and site.com (http and https)

what is the best way to configure 2 domains www.site.com and site.com http and https
it will be 1 wordpress behind.

do i need to install 2 domains or 1 ?
do i need to install 2 certificats or 1 ?
do i need to manually edit nginx conf file to do 301 redirect from “site” to www.site

Naively, I think you should :

About certificates : yes, you will need a certificate for both domains. But that shouldn’t be an issue : just go (for each domain) to Domain > your.domain.tld > Certificate in the webadmin, and add the certificate. (You can also do this from the command line)

1 Like

isn’t it much simplier to add 2 lines in nginx and restart it ?

i keep www as main , and redirect from another url

server {
listen 80;
return 301 https://www.site.org$request_uri;

and same for 443

If you are comfortable with editing conf manually (not everyone is), then maybe yes. But you might run into other issues, e.g. the SSO not allowing you to access www.domain.tld (before reaching the redirection). Then you’ll need to edit some stuff in /etc/ssowat, which is what the redirect app does for you.

thanks for comment Alex,
so event if i use redirect app i still need to create two domains and add 2 certificats via admin pannel
and then only use redirect app ?

Yes, because if you want your redirection to really work in all cases, you need to manage the case where your user attempts to access https://www.yourdomain.tld, in which case you do need a certificate for the redirection to work.

Hence, you need a ‘full web domain configuration’ with a valid certificate and so on

my main domain is https://www.yourdomain.tld
i declared it and added certificat.

question do i need to :

  1. declare yourdomain.tld in yunohost
  2. add certificat for https://yourdomain.tld,

i am asking the same questions again just to make sure i got you correctly.

Yes, you need to have both www.yourdomain.tld and yourdomain.tld registered in yunohost, and install a certificate on both.

Hello,
I’m redirecting a domain.com to www.domain.com with the Redirect app (I’ve choosen 301, permanent redirect).

My problem is that www.domain.com/blog/post1 works while domain.com/blog/post1 redirects me www.domain.com but not on the specified page.

How can I fix that?

Thank you.