Return 301 status code while redirecting product recommendation string query URLs

Topic summary

A Shopify developer is struggling to implement proper 301 redirects for product recommendation query string URLs (URLs containing pr_prod_strat parameter).

Current situation:

  • JavaScript-based redirection is working but returns client-side redirects instead of 301 status codes
  • Shopify’s native redirect manager doesn’t support query string URL redirects
  • The goal is to redirect from query string URLs to clean URLs while maintaining SEO value through proper 301 status codes

Technical challenge:
JavaScript executes client-side in the browser, making it impossible to return server-side HTTP 301 status codes. The developer needs a server-side solution.

Key issue:
The question remains unanswered regarding how to achieve server-side 301 redirects for these query string URLs within Shopify’s platform constraints. This likely requires either Shopify Liquid templating modifications, app-based solutions, or server configuration changes beyond standard theme JavaScript.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

Hi,

I have implemented redirection using JavaScript for Shopify recommended product string query URLs, but it isn’t returning a 301 status code. I also tried using Shopify’s own 301 redirect manager to redirect string query URLs, but the redirection for string query URLs doesn’t work there either. Can anyone help me return a 301 status code while redirecting string query URLs to non-string query URLs?

JS code I’ve used to redirect string query URLs:

Redirection preview:

String query URLs reported in GSC: