Configuring Redirects

NGINX came back to life!

And now both mydomain.tld and forms.mydomain.tld are redirected to anotherdomain.tld.

The only problem is that forms.mydomain.tld/myform is redirected to anotherdomain.tld too.

I understand, thank you.

I think I can live without redirecting forms.mydomain.tld. I think I will just have to delete its redirect.conf file.

I guess redirecting *.mydomain.tld except forms.mydomain.tld/myform is not easy. So I will just try to do at least another redirect for www.mydomain.tld, which will be satisfyingly enough for me.

1 Like

In order to achieve it, I added a Yunohost domain: www.mydomain.tld.
And then I copied the redirect file in its corresponding directory.
But the redirect does not work.
Am I missing something?

peer@mymachine:/etc/nginx/conf.d/www.mydomain.tld.d$ ls -hal
total 12K
drwxr-xr-x 2 root root 4.0K Mar 22 17:29 .
drwxr-xr-x 7 root root 4.0K Mar 22 17:21 ..
-rw-r--r-- 1 root root   52 Mar 22 17:29 redirect.conf
peer@mymachine:/etc/nginx/conf.d/www.mydomain.tld.d$ 
peer@mymachine:/etc/nginx/conf.d/www.mydomain.tld.d$ 
peer@mymachine:/etc/nginx/conf.d/www.mydomain.tld.d$ cat redirect.conf 
location / {
  return 301 https://anotherdomain.tld;
}
peer@mymachine:/etc/nginx/conf.d/www.mydomain.tld.d$ 

Did you restart nginx?

Yes, I did. Thank you.

I was struggling to find out where the problem was. Got it now. This time was a wrong record I had at my DDNS service. I fixed it and everything is ok now!

I don’t have a redirection from forms.mydomain.tld but I’m happy if the redirection for mydomain.tld and www.mydomain.tld work, and that’s the case.

Lots of thanks for your help and explanations!!

1 Like

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