Jump to content

How to automatically redirect from [example.com/store] to [example.com/store/category]?

Go to solution Solved by Spark-Plugin,

Recommended Posts

Hello, I would like to achieve the following (I assume, JavaScript is needed):

When visitors visit my online store at example.com/store, I want my visitors to be automatically redirected to one of the store categories at example.com/store/category.

Thank you in advance.

Link to comment
  • Solution

Hello @abc I hope you're having a great day!
 

Here’s a code you might find useful, 

  1. Navigate to: Settings > Advanced > Code Injection.
  2. Scroll down to the "Header" section and paste the code above.
  3. Replace /store/category with the actual path of the category page you want to send visitors to.
     
    <script>
      if (window.location.pathname === '/store') {
       window.location.href = '/store/category';
      }
    </script>

     

Edited by Spark-Plugin

- Answered by Iuno from sparkplugin.com

forumsignature-recommendedcopy2.png.0579645eb1430dc7c1059541dc6456c6.png

Link to comment
2 hours ago, Spark-Plugin said:

Hello @abc I hope you're having a great day!
 

Here’s a code you might find useful, 

  1. Navigate to: Settings > Advanced > Code Injection.
  2. Scroll down to the "Header" section and paste the code above.
  3. Replace /store/category with the actual path of the category page you want to send visitors to.
     
    <script>
      if (window.location.pathname === '/store') {
       window.location.href = '/store/category';
      }
    </script>

     

 

Thank you so much!

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.