0

I've a very specific problem with magento. At first let me explain what the problem is. I load magento into an iFrame to integrate the store into a webpage. This works like charm until it comes to amazon pay or unzer for example. Due to the iFrame, the payment fails or does not load at all (for security reasons).

My first idea was to break out of the iFrame, but I have no clue how to do it. So my second thought was I load the checkout page on top (leave the iFrame at this point) and create a page like amazons checkout page. But in this case, if I just redirect to the "origin" checkout page, the "REQUEST_URI" would change from "/shop/de/checkout" to "/store/de/checkout". To avoid this, I modified the .htaccess page from the webpage and added this rule:

 RewriteCond %{REQUEST_URI} (checkout|checkout\/)$ [NC]
 RewriteRule ^shop/(.*)$ /store/$1 [L,NC]

And yes, the REQUEST_URI doesn't change and the Magento store loads, but instead of the checkout page, I get a "The page you requested was not found" page. If I change the RewriteRule to

 RewriteCond %{REQUEST_URI} (checkout|checkout\/)$ [NC]
 RewriteRule ^shop/(.*)$ /store/$1 [R=301,L,NC]

it works - but the REQUEST_URI change (because of the redirect of course) and I have to avoid that.

It would be awesome if someone could explain why it behaves this way - and how I can fix that.

2
  • I'd read about cross-origin issue, stackoverflow.com/questions/40866219/… Sep 7, 2022 at 11:27
  • thanks for that hint, but in my case its same origin. The I want to redirect from "mydomain.com/shop/de/checkout/" to "mydomain.com/store/de/checkout/" without changing the url in the browser
    – Jeireff
    Sep 7, 2022 at 11:40

1 Answer 1

0

The solution was simple. Instead of "redirecting" to the store I proxy the checkout page. I had to modify the websites .htaccess (not the magento .htaccess) so that the RewriteRule looks like this:

  RewriteCond %{REQUEST_URI} (checkout|checkout\/)$ [NC]
  RewriteRule ^shop/(.*)$ https://example.com/store/$1 [P,L,NC]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.