Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Invalid Redirect

Solved

Invalid Redirect

smarteeformee
Shopify Partner
3 0 1

I am working on a theme (3.0) for a client.  We have an erroneous redirect happening from "/collections/smooth-as-silk" to "/products/smooth-as-silk".  No 301 Redirect rule exists for this redirect under the admin panel.  In the network panel of my browser, it is showing a 304 Redirect.  I have removed all the sections from the collections template to see if it was caused by something that made its way into a section.  I couldn't get the behavior to stop.  Does anyone have any ideas why this is happening, and how to prevent it from happening?  Or potential workarounds?

Accepted Solution (1)
SBD_
Shopify Staff
1831 273 423

This is an accepted solution.

Hey @smarteeformee 

 

Looks like it's been added to your theme.liquid. You can comment out/remove in Admin > Online Store > Themes > Edit Code > theme.liquid - scroll all the way down.

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 5 (5)

SBD_
Shopify Staff
1831 273 423

Hey @smarteeformee 

 

Are you able to share store URL / example? (DM is fine)

Scott | Developer Advocate @ Shopify 

smarteeformee
Shopify Partner
3 0 1

Here's the site: http://femininity.life.  At bottom of our page we have found the culprit redirects, but we cannot figure out where they are coming from.  There are no redirects set up for this in any plugin I can find, or in the Online Store settings.  @SBD_ 

I have run the debugger in Chrome and the page is loading with the redirects already on it - they don't appear to be placed there during JS runtime.

smarteeformee_0-1699467753727.png

This is causing a Javascript redirect from https://femininity.life/collections/smooth-as-silk to https://femininity.life/products/smooth-as-silk.  I have verified this is not coming from the theme.

I'm worried that uninstalling any app to rule it out as the cause will cause data loss for my client.

PaulNewton
Shopify Partner
7731 678 1630

Either a good example of why it's important for stores to be using version control or the github integration to help immediately rule out such things as being in the source.

 

Or If this turns out to be coming from an app this a prime example of why ALL injected code should be referenceable to the source app , at minimum in the source of theme previews.

 

@smarteeformee rule out the source of the issue.

Download the theme and search all  the files themselves for that window.location etc.

If on the homepage the code exist in the html source double check theme.liquid and ANY referenced snippets.

Or export the theme and test in a dev shop by reproducing the url structure.

 

Or make a duplicate theme and comment out {{ content_for_header }} in theme.liquid.

This will rule out scripttag based apps.

 If the problem persists with {{ content_for_header }} crippled  the code is being added by either an appblock, or it is actually in the theme somewhere either as that exact code or other javascript which generates it on page load.

In which case  disable javascript in your browser and test if it's added dynamically by a script file or your back to an app block maybe.

 

 

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


SBD_
Shopify Staff
1831 273 423

This is an accepted solution.

Hey @smarteeformee 

 

Looks like it's been added to your theme.liquid. You can comment out/remove in Admin > Online Store > Themes > Edit Code > theme.liquid - scroll all the way down.

Scott | Developer Advocate @ Shopify 

smarteeformee
Shopify Partner
3 0 1
Wow, I can't believe I missed that when searching for it twice in the
theme. This does resolve the issue.