Score:0

How to redirect in Nginx hidding the redirect path

ua flag

I have the next URL:

https://my-web.com/path1 and I would like to redirect the call to https://my-web/path2 but I would like that in the browser tab show's /path1. Is this possible?

I'm using a virtualhost in Nginx 1.16. I'm using a rewrite, but the problem is that in the browser tab it shows /path2 and I need /path1 but with the content of path1.

EDIT:

My vhost cfg:

server {
    root /var/www/myweb.dyndns.org;
    server_name myweb.dyndns.org www.myweb.dyndns.org;
    include global/global.conf;
    include global/wordpress.conf;
    rewrite ^/path1(.*)$ http://myweb.dyndns.org/path2 redirect;
}
br flag
Show config. Probably you're doing something wrong. This is basic nginx functionality.
herny avatar
ua flag
hello @AlexeyTen I just edit the OP
us flag
`redirect` issues a HTTP redirect response back to the client. Most likely you want `break` or `last` instead for an internal rewrite.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.