JavaScript-based redirects were detected on 3 pages using inline scripts like window.location.href or window.location.replace.
By Seoxpert Editorial · Published
Search engines may not reliably follow JavaScript redirects because they require script execution, unlike server-side redirects. This can lead to the wrong URLs being indexed or link equity not being properly transferred, negatively affecting SEO performance.
Unresolved JavaScript redirects can cause incorrect URLs to be indexed and loss of link equity.
An automated crawler scans for inline scripts using redirect patterns such as window.location.href, window.location.replace, or window.location.assign.
Problem: JavaScript Redirect in Inline Script
<script>
window.location.href = '/new-page';
</script>Fix: Server-side Redirect in .htaccess (Apache)
Redirect 301 /old-page /new-pageFix: Next.js Redirect in next.config.js
// next.config.js
module.exports = {
async redirects() {
return [
{
source: '/old-page',
destination: '/new-page',
permanent: true,
},
];
},
};Search engines may not execute JavaScript, so they can miss or ignore JS-based redirects, causing indexing issues.
Googlebot may execute JavaScript, but it is not guaranteed or consistent, so server-side redirects are more reliable.
Use server-side HTTP 301 (permanent) or 302 (temporary) redirects to ensure search engines properly follow and index the destination URL.
If client-side logic is required, ensure the canonical tag on the page always points to the correct target URL.
Run a scan to see if JavaScript-Based Redirects Detected affects your pages.
Scan my website →