Redirection chain and Javascript Redirect
-
Hi,
A redirection chain is usually defined as a page redirecting to another page which itself is another redirection.
URL1 ---(301/302)---> URL2 ---(301/302)---> URL3
But what about Javascript redirect? They seem to be a different beast:
URL1 ---(301/302)---> URL2 ---(200 then Javascript redirect)---> URL3
From what I know if the javascript redirect is instant Google counts it as a 301 permanent redirection, but I'm still not sure about if this counts as a redirection chain.
Most of the tools (such as moz) only see the first redirection.
So is that scenario a redirection chain or no?
-
It's a delicate balance between efficient routing and ensuring seamless transitions, where every decision shapes the user's path and perception. myvirtualworkplace
-
@LouisPortier said in Redirection chain and Javascript Redirect:
Hi,
A redirection chain is usually defined as a page redirecting to another page which itself is another redirection.
URL1 ---(301/302)---> URL2 ---(301/302)---> URL3
But what about Javascript redirect? They seem to be a different beast:
URL1 ---(301/302)---> URL2 ---(200 then Javascript redirect)---> URL3
From what I know if the javascript redirect is instant Google counts it as a 301 permanent redirection, but I'm still not sure about if this counts as a redirection chain.
Most of the tools (such as moz) only see the first redirection.
So is that scenario a redirection chain or no?
A JavaScript redirect, on the other hand, is a redirect that occurs using JavaScript code embedded in a webpage. Instead of relying on server-side redirects, JavaScript redirects are triggered when the page loads or when certain conditions are met, and they instruct the browser to navigate to a different URL. They can be used for various purposes, such as redirecting users after a certain amount of time, after a form submission, or based on user interactions.
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
Understanding the intricacies of redirection chains and JavaScript redirects is crucial for optimizing website performance and user experience. Proper implementation ensures smooth navigation and avoids unnecessary delays. Visit more
-
I appreciate your detailed explanation. To enhance accuracy in tracing redirects, ensure a cohesive sequence. Consider using a unified approach for hash numbers, perhaps generating a unique identifier for each transition. Additionally, refine the code logic to account for different redirection techniques, ensuring a seamless and connected mapping of the entire journey from A to D. If possible, share snippets of your code for more targeted guidance. shopify website design servicee austin
-
Thank you for the valuable feedback. While the current code successfully executes, it lacks accuracy in tracing the redirect sequence. The issue stems from the disjointed nature of the captured redirects, as seen in the isolated transitions from A to B, B to C, and C to D, where randomly generated hash numbers (channel_1 and channel_2) are utilized. This disrupts the continuity of the redirect chain, resulting in an inaccurate representation of the actual progression from A through D.
The objective is to effectively track the entire journey, encompassing transitions from A to B to C to D, across various redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. I would greatly appreciate your guidance on refining the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process. Liteblue
-
Thank you for the valuable feedback. While the current code successfully executes, it lacks accuracy in tracing the redirect sequence. The issue stems from the disjointed nature of the captured redirects, as seen in the isolated transitions from A to B, B to C, and C to D, where randomly generated hash numbers (channel_1 and channel_2) are utilized. This disrupts the continuity of the redirect chain, resulting in an inaccurate representation of the actual progression from A through D.
The objective is to effectively track the entire journey, encompassing transitions from A to B to C to D, across various redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. I would greatly appreciate your guidance on refining the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process. Liteblue
-
In the scenario you described, where there is a sequence of redirects involving both HTTP redirects (301/302) and a JavaScript redirect, it can be considered a redirection chain. The key point is that each step in the sequence contributes to the final destination of the URL.
In your example:
- URL1 redirects to URL2 using an HTTP 301/302 status code.
- URL2, after an HTTP 200 response, triggers a JavaScript redirect to URL3.
From Google's perspective, if the JavaScript redirect is instantaneous and does not introduce a delay, it might treat it similarly to a traditional 301 permanent redirect. However, it's important to note that search engines may interpret JavaScript redirects differently, and their behavior may evolve over time.
Tools like Moz may sometimes focus on the initial HTTP redirect and not delve into subsequent steps, potentially overlooking the complete redirection chain. Therefore, discrepancies in what different tools report could occur.
For a more comprehensive understanding, you might consider using tools or methods that specifically analyze JavaScript-based redirects or inspect the network requests in a browser's developer tools to see the entire redirection sequence. This way, you can get a clearer picture of how search engines and various tools interpret the entire redirection chain, including both HTTP and JavaScript redirects.
-
Thank you for the insightful feedback. While the current code executes successfully, it falls short in accurately tracing the redirect sequence. The issue lies in the disjoint nature of the captured redirects, exemplified by the isolated transitions A->B, B->C, and C->D, where the hash numbers (channel_1 and channel_2) are generated randomly. This disrupts the continuity of the redirect chain, failing to reflect the actual progression from A through D. The goal is to effectively track the entire journey, A->B->C->D, across different redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. Could you provide guidance on how to refine the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process?
-
Thank you for the insightful feedback. While the current code executes successfully, it falls short in accurately tracing the redirect sequence. The issue lies in the disjoint nature of the captured redirects, exemplified by the isolated transitions A->B, B->C, and C->D, where the hash numbers (channel_1 and channel_2) are generated randomly. This disrupts the continuity of the redirect chain, failing to reflect the actual progression from A through D. The goal is to effectively track the entire journey, A->B->C->D, across different redirection techniques such as meta-refresh, JavaScript, and HTTP redirects. Could you provide guidance on how to refine the code to maintain the integrity of the redirect sequence, ensuring a connected and sequential mapping of the redirection process? Liteblue
-
Thank you for your feedback. While the code is currently functional, it doesn't yield the expected outcome. The recorded redirect chain appears disjointed, capturing transitions like A->B (channel_1 -> channel_2), B->C (channel_1 -> channel_2), and C->D (channel_1 -> channel_2). The issue lies in the randomly generated hash numbers (channel_1 and channel_2), preventing the proper linkage of the redirect chain. The goal is to accurately capture sequential events such as A->B->C->D, considering various redirection methods like meta-refresh, JavaScript, and HTTP. How can I modify the code to implement this strategy and ensure the redirection chain is connected as intended?
-
Thank you for your feedback. Although the code is functional, it does not produce the expected result. Currently, the recorded redirect chain is disjointed, capturing transitions like A->B (channel_1 -> channel_2), B->C (channel_1 -> channel_2), and C->D (channel_1 -> channel_2). In this case, the hash numbers (channel_1 and channel_2) are randomly generated, preventing the proper linking of the redirect chain. The objective is to accurately capture the sequential events of A->B->C->D, considering various redirection methods such as meta-refresh, JavaScript, and HTTP. How can I modify the code to achieve this strategy and ensure the redirection chain is connected as intended? Liteblue
-
thx, the code works, but not as expected: A->B->C->D (channel_1 -> channel_2 -> channel_3 -> channel_4).
In my case it will record a redirect chain of A->B->C->D like:
A->B (channel_1 -> channel_2), than B->C (channel_1 -> channel_2), C->D (channel_1 -> channel_2); where channel_1 & channel_2 are random hash numbers.
So I can not link the chain together. that would be the strategy to capture the chain of events (while the pages redirect using, meta-refresh, javascript, http...)? Liteblue USPS
-
window.location.replace('http://example.com');
It's better than using window.location.href = 'http://example.com';
Using replace() is better because it does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco.
If you want to simulate someone clicking on a link, use window.location.href
If you want to simulate an HTTP redirect, use window.location.replace
You can use assign() and replace methods also to javascript redirect to other pages like the following:
location.assign("http://example.com");
The difference between replace() method and assign() method(), is that replace() removes the URL of the current document from the document history, means it is not possible to use the "back" button to navigate back to the original document. So Use the assign() method if you want to load a new document, andwant to give the option to navigate back to the original document.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Wordpress Redirect Loop on domain name
Hi hopefully someone can help - pulling my hair out - can't seem to find where this redirect is coming from. Curently there is a redirect from http://bimi to https://bimi then to our real domain https://www.bimi But I can't find it - I have checked through hta access file, through YOAST redirects - any suggestions from anyone who has has this before in wordpress? | http://bimi.co | 23 | 0 | 3 | |
Technical SEO | | KellyDSD86
| | | Associated Pages | |
| | | https://bimi.co/ | 23 | 1 | | |
| | | Office Furniture Online | The UK's major Office Furniture Retailer | BiMi.cohttps://www.bimi.co/ | HTA access says the following - I have googled to see whether its causing it but none the wiser! BEGIN LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! <ifmodule litespeed="">RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule ^min/\w+.(css|js) - [E=cache-control:no-vary] marker CACHE RESOURCE start RewriteRule wp-content/./[^/](responsive|css|js|dynamic|loader|fonts).php - [E=cache-control:max-age=3600] marker CACHE RESOURCE end marker FAVICON start RewriteRule favicon.ico$ - [E=cache-control:max-age=86400] marker FAVICON end ###</ifmodule> LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END LSCACHE BEGIN NON_LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! marker MINIFY start <ifmodule mod_rewrite.c="">RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+).(css|js)$
RewriteCond %1/wp-content/cache/$2/$1.$2 -f
RewriteRule min/(\w+).(css|js) wp-content/cache/$2/$1.$2 [L]</ifmodule> marker MINIFY end LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END NON_LSCACHE BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress0 -
Backlinks that go to a redirected URL
Hey guys, just wondering, my client has 3 websites, 2 of 3 will be closed down and the domains will be permanently redirected to the 1 primary domain - however they have some high quality backlinks pointing the domains that will be redirected. How does this effective SEO? Domain One (primary - getting redesign and rebuilt) - not many backlinks
Technical SEO | | thinkLukeSEO
Domain Two (will redirect to Domain One) - has quality backlinks
Domain Three (will redirect to Domain One) - has quality backlinks When the new website is launched on Domain One I will contact the backlink providers and request they update their URL - i assume that would be the best.0 -
Redirect root domain to www
I've been having issues with my keyword rankings with MOZ and this is what David at M0Z asked me to do below. Does anyone have a solution to this? I'm not 100% sure what to do. Does it hurt ranking to have a domain at the root or not? Can I 301 redirect a whole site or do I have to do individual pages. "Your campaign is looking for rankings for the www version of the campaign but the URL resolves as a root domain. This would explain the discrepancy. Since there is no re-direct between the two, you can have brickmarkers.com 301 re-direct to www.site.com which will prevent you from re-creating your campaign to track the root domain. Once the re-direct is in place it will take a while for Google to show the www version in the results in which your campaign rankings will be accurate." Thanks
Technical SEO | | SeaDrive0 -
CPanel Redirects: Know How Needed
I have ran into something I have not ran into in the past. cpanel, setting a 301 redirect. --Drop down domain choice ----- / ---- ?attachment_id=539 http://ipromotis.com (Only box marked is redirect with or without www) Produces 301 Redirect http://ipromotis.com to http://ipromotis.com
Technical SEO | | yeagerd0 -
404 Errors & Redirection
Hi, I'm working with someone who recently had two websites redesigned. The old permalink structure consisted of domain/year/month/date/post-name. Their developer changed the new permalink structure to domain/post-name, but apparently he didn't redirect the old URLs to the new ones so we're finding that links from external sites result in 404 errors (once I remove the date in the URL, the links work fine). Each site has 3-4 years worth of blog posts, so there are quite a few that would need to be changed. I was thinking of using the Redirection plugin - would that be the best way to fix this sitewide on both sites?Any suggestions would be appreciated. Thanks, Carolina
Technical SEO | | csmm0 -
Automatic redirect to external urls
Hi all, I'm developing a dynamic qr code service.. The service works in the following way: You create an account with an associated QR CODE pointing to a url like:
Technical SEO | | raulo79
- http://domain.me/username The user can change the target of this url.. he can:
- point to an external url ( his website for example)
- point to a vCard download page
- a mobile ready webpage ( no redirection in this case)... Visiting http://domain.me/username my company logo is displayed and we redirect the visitor with a: header("Refresh: 5;URL=http://userdomain.tld"); Google is indexing many user's URLs, this is good for those users pointing to the mobile ready webpage, in this case there is no redirection, but Google is indexing many urls that redirect to an external url and I don't know how to avoid this.. I can't do an header('Location: http://www.example.com/'); because I need to display our logo after redirection.. how can I do google friendly? Sorry for my english, I hope you can undestand the problem. Best regards.
Mauro.0 -
Redirecting one ecommerce site to another
Hi I'm planning to redirect one large ecommerce site to another. Here's how I was thinking of doing it: crawl both sites with Xenu and export urls to a CSV match urls where possible, redirecting pages from site A to relevant ones in site B all others will be redirected to site B's home page Now, I'm dealing with thousands of URLs here, so any way to make it easier would be great. Could this mean just redirecting all of Site A's pages to Site B's homepage would be worth it? Or does redirecting relevant pages where possible seem the best idea? Thanks guys!
Technical SEO | | neooptic0 -
Hiding text with Javascript and a more button
I am considering putting a block of text on may pages, that initially appears as a snippet with a 'show more' button that expands to show the whole lot. Question: If the search engines can see the whole lot, but the visitor only sees the snippet until they click 'show more' then is this cloaking? Is it a really bad idea? Or can I get away with it because I am not being deceptive just improving the design? Help!
Technical SEO | | mascotmike0