How to Create URL Redirects and URL Mapping

How to Create URL Redirects and URL Mapping

By Michael Chen

December 2, 2024 at 05:55 AM

URL redirection helps prevent visitors from encountering broken or duplicate pages by forwarding traffic from inactive to active pages. Here's how to set up and manage URL redirects effectively:

Types of Redirects

301 Redirect (Permanent):

  • Transfers search engine ranking from old to new page
  • Use when permanently changing URLs, deleting pages, or moving to different domains
  • Original URL must be deleted or disabled

302 Redirect (Temporary):

  • Maintains original page ranking
  • Ideal for seasonal changes or temporary updates
  • Original page remains intact for future use

Creating Redirects

  1. Access URL Mappings in Developer Tools
  2. Add redirects using proper formatting
  3. Click Save

Basic Redirect Format:

/old-url->new-url 301

For multiple items in collections (blogs, products, events):

/old-collection/[name]->new-collection/[name] 301

Important Guidelines:

  • Limit: 400kb (approximately 2,500 redirect lines)
  • Higher redirects take precedence over lower ones
  • Source page must be deleted or disabled
  • Use exact case matching for URLs
  • Avoid symbols like ?, &, or # in redirects

Common Use Cases

Blog Posts:

/blog/[name]->posts/[name] 301

Store Products:

/shop1/[name]->shop2/[name] 301

External Domains:

/page->https://external-domain.com 301

Seasonal Pages:

/summer-sale->/fall-sale 302

Troubleshooting

Common Errors:

  • "Invalid mapping: Not enough parts" - Missing -> or redirect type
  • "Invalid mapping: Too many parts" - Extra elements in redirect
  • "Expected to find 301 or 302" - Incorrect redirect type format

404 Errors May Occur When:

  • Redirect is triggered multiple times within 2 minutes
  • Target page is disabled or deleted
  • Ajax loading is enabled (version 7.0)

Remember to regularly clean up inactive redirects and ensure all target pages are active and accessible.

Related Articles

Previous Articles