Jump to content

simplified URL redirect to existing page

Recommended Posts

Hi! I'm pretty new to Squarespace and website building in general, so please be kind 😉

I am working on updates to an existing website for the school I work at.   For marketing purposes, I'd like to create a simplified URL people can type in and have it redirected to the actual tour page, to allow people to type something simple that they will remember, as opposed to what the actual URL slug is.  

For example, the existing page I want people to access is:  www.cascadia.school/schedule-tour-inquiry-form  but in marketing materials, for simplicity sake, I'd like to just post the address as www.cascadia.school/tour, so I'm trying to create a temporary redirect as opposed to changing the /url slug completely (for SEO reasons, etc.). 

Following the online tutorial, I went to the page for our tours, found URL Mappings and typed in the following:

/tour -> /schedule-tour-inquiry-form 302

This doesn't seem to be working, as when I go to a new browser window and type in www.cascadia.school/tour, it takes me to the 404 error page.   

There is no actual page on my site called www.cascadia.school/tour, so could that be the problem?  Though from what I read, that shouldn't be the case.  

Any idea what I'm missing? 

Edited by CKnapp
Link to comment
  • 4 months later...
On 3/7/2023 at 4:34 AM, melaniejaane said:

Hey @tuanphan is there a way to edit this script so it doesn't redirect when we're in config mode? Thanks 🙂 

Suppose your site url is

melanie.squarespace.com

You can add this to url to disable code in edit mode

melanie.squarespace.com/config/safe

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
17 hours ago, tuanphan said:

Suppose your site url is

melanie.squarespace.com

You can add this to url to disable code in edit mode

melanie.squarespace.com/config/safe

 

Thanks @tuanphan is there a way to do this automatically in the script, like adding an exemption if the source comes from the squarespace url as opposed to the public domain?

Just discovered the lazy summaries plugin won't work unless the source page is enabled and password free.  😞 Unfortunately need to go back through multiple websites, unlock the blog pages then set up redirects. Hoping to limit opt-in/out actions as much as possible for other site contributors. 🤞

Link to comment
<script>
	
 if (window.location.hostname == 'unityweek.squarespace.com') {

 clearTimeout(function(){
	window.location.href = '/resources-list'; /*existing page - blog*/
})();
 } else { 
   setTimeout(function(){
    
       window.location.href = '/resources'; /*redirect - new page */
         }, 000);
 }
</script>

UPDATE:
@tuanphan I've written the above snippet which half solves the problem. Maybe you can improve it?

It turns off the redirect function when using the Squarespace hostname, unfortunately I couldn't find a way to specify the config mode though. Would you know how to do this?
Thanks again! 😊

 

Squarespace url: unityweek.squarespace.com/resources-list

Public url: unityweek.co.nz/resources-list

 

Link to comment
8 hours ago, melaniejaane said:
<script>
	
 if (window.location.hostname == 'unityweek.squarespace.com') {

 clearTimeout(function(){
	window.location.href = '/resources-list'; /*existing page - blog*/
})();
 } else { 
   setTimeout(function(){
    
       window.location.href = '/resources'; /*redirect - new page */
         }, 000);
 }
</script>

UPDATE:
@tuanphan I've written the above snippet which half solves the problem. Maybe you can improve it?

It turns off the redirect function when using the Squarespace hostname, unfortunately I couldn't find a way to specify the config mode though. Would you know how to do this?
Thanks again! 😊

 

Squarespace url: unityweek.squarespace.com/resources-list

Public url: unityweek.co.nz/resources-list

 

Config mode, you mean disable code on edit mode?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.