Contigo Studio

View Original

How to Add Squarespace Redirects That Work from Facebook & other platforms.

Introduction

Recently, I decided to update the URL slug on my blog page. To preserve the SEO I built, I needed to add redirects to ensure the old links worked. While these standard redirects functioned fine, I noticed they failed for links shared on Facebook. This happened because Facebook added query parameters to the URLs. Here’s how to ensure your redirects work seamlessly, even with these additional parameters.

About This Tutorial: Why Redirects Matter

Redirects are essential for maintaining your website's user experience and SEO value when URLs change. Without them, visitors from social media platforms like Facebook might encounter broken links, leading to a poor user experience and lost traffic.

Understanding Query Parameters

When users click on a Facebook link, it often appends unique query parameters like ?fbclid to the URL for tracking purposes. These parameters can interfere with normal redirects, causing broken links or errors.

Example problematic URL:

See this content in the original post

The Step-by-Step Guide

Here's a step-by-step guide to set up redirects with an additional script and ensure they work correctly, even for links with query parameters like “fbclid”.

Step 1: Add Specific Redirects in Squarespace

  1. Log into Squarespace:

  • Go to your website’s home page and log in.

  1. Navigate to Settings:

    • From the home menu, go to Settings > Advanced > URL Mappings.

  2. Add URL Mappings:

    • Add each specific redirect. For example:

See this content in the original post

Step 2: Handle Dynamic Redirects with JavaScript

To handle dynamic redirects and query parameters like “?fbclid=”

  1. Go to Code Injection:

    • Navigate to Settings > Advanced > Code Injection.

  2. Add JavaScript Code:

    • Insert the following script into the header or footer section (don’t forget to change the URL’s to match the redirect URL’s you entered above:

See this content in the original post

Note: Don’t forget to place this code between an opening and closing script tag: <script> and </script>.

Step 3: Testing

  1. Clear Cache:

    • Clear your browser cache or use incognito mode.

  2. Test URLs:

    • Verify the redirects by testing specific URLs with and without query parameters.

Conclusion

By combining specific URL mappings in Squarespace with dynamic JavaScript-based redirects, you can ensure that all links, including those from Facebook and other social media platforms, redirect correctly. This approach maintains the integrity of your website’s structure and user experience.

FAQs about Redirects and Social Media Links

Need Help Implementing Your Redirects?

Dennis Pal
Web Designer/Developer

At Contigo Studio, I specialize in creating flawless web experiences tailored to your business needs. Whether it's setting up effective redirects, customizing your site, or solving web design challenges, I've got you covered. I ensure your website performs seamlessly across all platforms and social media channels.

Contact me at Contigo Studio today to elevate your website's functionality and user experience. Let me handle the technical details, so you can focus on what you do best.

Need assistance? I'm here to help every step of the way.

You might also like…

See this gallery in the original post