Scenario:
Site1 : www.site.com
Site2 : shop.site2.com
The idea is to make a proxy redirect so if I access www.site.com/shop to be redirected to shop.site2.com and keep the URL in the browser.
This can be done either by using mod_rewrite (if both sites are on the same server) or by using mod_proxy. In my case I had to do this on a Plesk server.
I’ve created in /var/www/vhosts/site.com/conf a file called vhost.conf that contains:
ProxyRequests off
Order deny,allow
Allow from all
ProxyPass /shop http://shop.site2.com
ProxyPassReverse /shop http://shop.site2.com
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
Order allow,deny
Allow from all
Then I ran:
/usr/local/psa/admin/bin/websrvmng -a -v
Verify httpd.include to see if there is any Include directive.
Now if you go to www.site.com/shop/ you should be redirected to shop.site2.com. Notice the trailing slash after (../shop/). That needs to be there otherwise it won’t load the images properly.
This can be fixed by adding in vhost.conf a Rewrite rule like:
RewriteEngine on
RewriteRule ^/shop$ /shop/ [R]
The post Using mod_proxy in Plesk to redirect to a different site appeared first on x83.net.