Browser button back. HELP)

Hello everyone.
I get big problem with redirect.
Now i have some products with redirect to another pages.
After user redirected he can’t use browser button (important this button) back because after click back he going to product page which redirect again - like infinity loop.

How I can change link for this button or how I can make some another redirect for products?
ID - its ID of product.

try to click back for understanding what I mean (sorry for my poor english)

Its very big problem and i very need to solve this, please…)

import wixLocation from 'wix-location';

    $w.onReady(function () {
    $w('#productPage1').getProduct()
    .then( (product) => {
 if(product._id === '18837fe4-787c-46bb-8c1d-9dcf0b322294') {
         $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/carbon');
     }
 else if (product._id === '4663b6cd-0297-4125-8d4f-dcf61d73b467') {
          $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/label');
     }
 else if (product._id === 'b696e3e2-5a90-d84e-7ebb-d51b7b47ae46') {  //geilik4x4 store (main page)
          $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/gelik4x4');
     }
 else if (product._id === 'd7a7eb5d-3a60-263f-b2bb-850f125d2c99') { //geilik6x6 store (main page)
          $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/gelik6x6');
     }
 else if (product._id === 'fa563ab3-607a-9eef-fa89-ea2743e37879') { //carbon store (main page)
          $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/carbon');
     }
 else if (product._id === 'a44fa427-cdfd-331f-6f8a-f27d033bd4a7') { //label store (main page)
          $w('#productPage1').hide()
         $w('#group1').hide()
         wixLocation.to('/label');
     }
 else{
         console.log('product')
     }
})

});

maybe i should make it in editor X by dynamic pages?
if it possible there…

There’s no reason to move to editor X for this reason. t’s not a matter of responsiveness.
(Anyway, I don’t understand your question, so I can’t help. Sorry…)

Hello.Thank you for your answer.
I have several products, when clicking on which user should go to another page.

I wrote a code for redirecting (does a redirect from the product page), but there is a problem - when user clicks the back button, he returns to the product page, from which he gets a redirect again.
and I want to make it return to the store page.

Or to remake somehow all this without redirecting, but I don’t know how.

Now it’s better for understanding?
Sorry for my English)

Now it’s clearer, but any possible solution is probably pretty complicated (because Wix Stores is an app limit API access). If they were regular pages it was much easier (you could use a datahook to replace the target url or you could just use routers with redirect).

@jonatandor35 hmm…
but if I’ll use dynamic pages for this also will be need to think about cart button, right?

Now looks like I find solution, but have some problem:

I have made redirect 301 but for redirect from product page need reload page…
How i can reload page for once automatically?
And with this solution don’t have any problems with turns back by browser buttons.

For start this tag < meta http-equiv = “Refresh” content = “15” / > need also reload by user.
With time out script same problem…
setTimeout ( function (){
location. reload () ;
} , 15000 ) ;