Hello friends!
I have a problem to several days without solution.
I created a subdomain sub.example.com.
To redirect all urls of this subdomain (www to no-www), put the following code into the server (/etc/nginx/sites-available/sub.example.com):
server_name www.sub.example.com; return 301 $scheme://sub.example.com$request_uri;
I saved the file and restarted the nginx.
Once configured normally redirects www.sub.example.com to sub.example.com
The problem is that when an entire slug does not redirect and gives 404, in both cases below:
www.sub.example.com/post-1.html to sub.example.com/post-1.html
www.sub.example.com/img/image.jpg to sub.example.com/img/image.jpg
Can anyone give me a light for me to see what I’m doing wrong?
Thanks!
TRADUZIDO DE:
Olá amigos! Estou com um problema a varios dias sem solução.
Criei um subdominio sub.example.com
Para redirecionar todas as urls desse subdominio (de www para no-www), coloquei o seguinte codigo dentro do server (/etc/nginx/sites-available/sub.example.com):
CODIGO
Salvei o arquivo e reiniciei o nginx.
Depois de configurado redireciona normalmente de www. sub.example.com para sub.example.com
O problema é que quando é uma slug inteira não redireciona e ainda dá erro 404, em ambos os casos abaixo:
www. sub.example.com/post-1.html para sub.example.com/post-1.html
www. sub.example.com/img/image.jpg para sub.example.com/img/image.jpg
Alguem pode me dá uma luz pra mim ver o que estou fazendo de errado?