• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

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

Question

shine_victim    2

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.

 

Scenario

  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!

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.