0

I want my same website to accessible from a subdirectory. For example, right now my website is

https://example.com

What I want is, that it should also be reachable using:

https://example.com/hi

That means each path that is accessible from https://example.com should also be accessible from https://example.com/hi. How could I do this. Here is what I tried in my server config.

    location /hi {
          proxy_pass https://example.com
    }

Right now, if I try https://example.com/hi, it gives out Bad Gateway. What is it that I should be doing?

1
  • You should be checking the error log. Dec 10, 2020 at 18:19

1 Answer 1

0

Instead of using proxy_pass did you try using rewrite?

location /hi/ {
 rewrite ^/hi(/.*)$ $1 break;
}
2
  • Could you please explain what has happened here?
    – Amanda
    Dec 13, 2020 at 6:04
  • The subdirectory /hi/ gets rewritten so for the server it looks like / was requested. No need to proxy_pass since the website is not on a remote server. Otherwise just add it.
    – unNamed
    Dec 13, 2020 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .