• 0

(htaccess) Redirect users to another site whilst keeping URL the same



Good day to all Neowinians!


I have a query regarding htaccess but unfortunately my htaccess knowledge is as strong as my ability to speak Latin (zero)!


I have a requirement to serve content from SiteB whilst keeping the URL as SiteA.  I will try and outline as this as well I can.



  1. Main site sits at www.SiteA.com (Wordpress site)
  2. Customer also has a Magento site hosted on the same server under a separate URL/account (purchase.SiteB.com)
  3. Customer "needs" to serve the purchase.SiteB.com site/content when a visitor visits www.SiteA.com/purchase


Here is my poor attempt of trying to engineer this myself so please, go easy on me, htaccess is not a strong point at all for me:


SiteA.com htaccess entry

RewriteCond %{REQUEST_URI} ^/purchase/(.+)
RewriteRule ^ https://purchase.SiteB.com/%1 [L,P]

purchase.SiteB.com htaccess entry

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(.+)                     [OR,NC]
RewriteRule ^ /%1     [L,P]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


Any tips and advice would be greatly appreciated heroes!


Thanks in advance!

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.