Answer the question
In order to leave comments, you need to log in
How to redirect some pages in ngninx?
Good to everyone. I've looked all over the internet and haven't found an answer yet. How to redirect a page with a specific get parameter to another schema.
It is required to open 2 pages of the site only via https. The entire site is http.
these pages
http://mysite/component/content/article.html?id=71
http://mysite/component/content/article.html?id=72
It is necessary that only 301 redirects to the https protocol work on them.
What I have tried:
if ($scheme = 'http' ) {
rewrite /component/content/article.html?id=71$ https://мойсайт/component/content/article.html?id=71 permanent;
}
Answer the question
In order to leave comments, you need to log in
You need to write location
inside the section server
that listens on the 80th port. In location
you need to check the get parameter.
server {
listen 80;
location ~* /component/content/article.html {
if ($args ~ "^id=(71|72)") {
return 301 https://мойсайт$request_uri;
}
}
# всякие ваши настройки
}
/private/component/content/article.html
and already for /private
always do a redirect to HTTPS?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question