Apache – How to map a domain to specific path of another domain on the same host?

Posted on

Apache – How to map a domain to specific path of another domain on the same host? – A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about Apache – How to map a domain to specific path of another domain on the same host? was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, domain-name-system, apache-2.4, virtualhost, .

I have a WordPress website having a domain for example: example.com and there’re a few pages like example.com/shop , example.com/products/sample-product which I want to be viewed via myshopexampledotcom , myshopexampledotcom/products/sample-product respectively. I know writing a simple 301 redirect will do the job but I don’t want to create a new WordPress site for myshopexampledotcom instead I would like to simply map specific pages from example.com to myshopexampledotcom. Is it possible via writing something inside a VirtualHost?

Correct me if i misunderstood the question but ProxyPass will do the thing. If you want to map example.com/shop to myshopexample.com you need to add below line in your example.com virtualhost configuration.

ProxyPass /shop http://myshopexample.com/
ProxyPassReverse /shop http://myshopexample.com/

For this you need to enable mod_proxy module in your apache configuration.
Read more for reverse proxy guide.
https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Leave a Reply

Your email address will not be published. Required fields are marked *