0

I have a website http://example.com, which contains two folders http://example.com/site/ and http://example.com/blog/, placed at hosting X. Domain example.com is hosted by the same hosting X.

Now the folder /blog/ migrates to hosting Y.

How can i achieve, that the folder /blog/ and all nested subfolders and URLs are available by the old URL like http://example.com/blog/ or https://example.com/blog/article1/, with domain name, hosted by hosting X?

I think into direction of CNAME, but not sure, how exactly is it to manage.

2
  • 1
    The correct technical jargon to map a specific URL path from one server to another is to “reverse proxy” (you can’t do that via a CNAME DNS record) - most web servers provide a solution for that. The ProxyPass directive in for example Apache and Nginx does that.
    – Bob
    Mar 29, 2021 at 14:39
  • @HermanB Thank you! Correct terminology - this is indeed, what i'm missing.
    – Evgeniy
    Mar 29, 2021 at 14:41

1 Answer 1

1

The URL paths are a HTTP level concept and CNAMEs are DNS concept. This means CNAMEs cannot be used to make any changes to HTTP level mappings.

Instead, you need to add HTTP reverse proxying in your setup. Your server that hosts http://example.com, needs to forward requests arriving at http://example.com/blog/ to hosting provider Y.

This means that all user visitor traffic will go via provider X, which will fetch part of the content from provider Y.

Personally, I think reverse proxying is not a good idea in this context. I would move the /blog to http://blog.example.com and then issue 301 redirects from http://example.com/blog to http://blog.example.com.

3
  • Could you please explain, why do you mean, it would be not a good idea? I plan to use this temporary, no longer as a month, until the whole site migrates to the new hoster. My first idea was placing the blog at subdomain too, but in terms of SEO changing of the URL would be a very bad idea.
    – Evgeniy
    Mar 29, 2021 at 14:43
  • For temporary usage this is an OK solution. It will add latency for the traffic to /blog/ destination due to the proxying, but for transition period it is OK. Mar 29, 2021 at 14:51
  • Ok, understand. Thank you!
    – Evgeniy
    Mar 29, 2021 at 15:02

You must log in to answer this question.

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