Managing Live Squarespace Website: URL Mappings & Custom Redirects

When your Squarespace website is live, here arises a question - how to edit webpage content so that it wouldn’t affect user experience? Or what if you deleted a webpage and you would like to create a custom URL redirect to an active page? Read this article for some great tips.

1. Creating URL Mappings

URL mappings allow your to forward visitors away from pages that don't exist to active pages so that you do not lose your traffic. This can be for a permanent change (301 redirect) or a temporary change (302 redirect). URL mappings can be created for a single page as well as for multiple blog posts, events, or products. This approach is useful if your webpage has been deleted and you would like to forward the traffic to another place.

To create an URL redirect, from your Home menu, click Settings → Advanced → URL Mappings. Read this Squarespace article for more details - click.

URL redirects only apply to the built-in and custom domains connected to your Squarespace site. If your domain is hosted by another provider, connect it to your site before using URL redirects.

2. Creating Custom Redirects

URL mappings method is great, however, it cannot be used for existing pages or external links. You may wish to create a custom redirect if:

  • you are planning to do some temporary works on the page and would like to take care about your visitors and send them to another page;

  • you would like to set up a permanent redirect (f.ex., if you do not want visitors to access the blog page but rather prefer to show them a nicely styled summary of blog posts on a different page).

This code allows you to create a custom redirect. Paste this into the website “head” (Settings → Advanced → Code Injection → Header Code Injection field) and modify the "initialURL" and "newURL" to the relevant values for your pages or even external website. You can also paste this code into the page “head” (Page Settings → Advanced → Code Injection → Header Code Injection field).

<!-- Custom URL Redirect -->
<script>
   var fromUrl = '/initialURL';
   var toUrl = '/newURL';
   // do not edit below this line
   var fromRegex = "^\\" + fromUrl + "\\/?$";
   var match = location.pathname.match(new RegExp(fromRegex, 'i'));
   if (match && !window.frameElement) {
     window.location.replace(toUrl);
   }
 </script>
<!-- End Of Custom URL Redirect -->

We hope these tips will help you manage your live Squarespace website without compromising user experience or loosing traffic. If you have any questions or ideas please leave a comment below!