How to map a domain to a sub-path on another domain?

Anyone know a way to configure Apache to map a domain to a specific sub-path on another domain? For instance I have primary-domain.com/some-path, which I'd like to map a different domain onto so that the content of primary-domain.com/some-path comes up, while the address bar continues to show other-domain.com. The paths below this point would also follow the same pattern, for example, other-domain.com/more would load the content of primary-domain.com/some-path/more

So in a nutshell…

Type URL: other-domain.com

Page loaded: primary-domain.com/some-path

URL remains: other-domain.com

Type URL: other-domain.com/more

Page loaded: primary-domain.com/some-path/more

URL remains: other-domain.com/more

Hope this makes sense - let me know if I can clarify better. Thanks in advance for any tips!

2 Replies

If these are all on the same Linode, just use VirtualHosts:

 <virtualhost other-domain.com:80="">...
    DocumentRoot /srv/www/primary-domain.com/public_html/some-path
    ...</virtualhost> 

and if it's not on the same server, look into mod_proxy

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct