Answer the question
In order to leave comments, you need to log in
How to make .htaccess in nginx?
Good day forum users.
I ask for your help.
I need to redirect to nginx. I found the code myself, but could you tell me what file extension in nginx should be done. On Apache .htaccess, but in nginx I don't know what it should be.
And the file itself should be dumped into the root folder of the site?
If it's not difficult, check if the code is correct.
Code:
New Server Block - www to non-www
server {
listen 80;
listen 443 ssl;
server_name www.site.com.ua;
return 301 $scheme://website.com.ua$request_uri;
}
Answer the question
In order to leave comments, you need to log in
Nginx doesn't understand htaccess and won't.
It is necessary to port your htaccess to the location set with handles / third-party services.
The code does not say anything, in general it will only work for a redirect.
Use allow|deny directly in the config.
The code is incorrect, it seems that you need to describe location / and it already contains a redirect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question