The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. Redirecting a working dynamic URI to a new static format

    Redirecting a working dynamic URI to a new static format

    Intermediate & Advanced SEO
    2 2 264
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vividwebdesign
      vividwebdesign last edited by

      Hi all

      I am having some issues rearding url rewrites and 301 redirects with 1 and 1 hosting and am unsure of the best approach. The website is a custom made shopping cart system with categories and products.

      The current urls for categories are : index.php?l=product_list&c=1      The new url format required is : /banner-stands

      After a little bit of research I added the following into the htaccess file;

      Options +FollowSymlinks
      AddType x-mapp-php5 .php

      RewriteEngine On

      RewriteBase /

      RewriteRule ^banner-stands/?$ index.php?l=product_list&c=1 [R=301,NC,L]

      Which works but I have a few questions

      Question 1: Is this the best approach as there are 55 categories and 179 products to write redirects for

      Question 2: Or is it better to firstly add id=banner-stands into the url and then create 301 redirects to the new url and then rewrite the url.

      Thanks

      1 Reply Last reply Reply Quote 0
      • FedeEinhorn
        FedeEinhorn last edited by

        This is what I would do:

        .htaccess

        Options +FollowSymLinks -Multiviews -Indexes
        RewriteEngine On

        #This line is for the categories
        RewriteRule ^category/(.*)$ index.php?l=product_list&category_name=$1 [L]

        Note: you will need a new rule for each "type" of page. That was an example for the categories only.

        Then you will need to add some PHP code to read the $_GET["category_name"] variable, which should be text (like banner-stands) and get the category id from your database to later load the products. You have several ways to do that, for example: insert an extra column in the DB with the category name "dashed" and search the category id using that new field.

        You should then change your internal linking to use those new URLs instead and add a rel=canonical pointing to the new versions of the URLs.

        Don't 301 all others until you have the above solved and working. Make sure you make everything safe, as with that structure something like  index.php?l=product_list&c=1&sort=asc won't work anymore unless you create extra rules for that, same as with pagination, if you have any.

        Hopes this gives you an idea on where to start.

        ***You are not redirecting dynamic to static urls, you are just making them friendlier 🙂

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • Redirecting main www. subdomain to new domain. Can you then create a new subdomain on the old domain?
          RobertFisher
          RobertFisher
          0
          6
          370

        • New Site (redesign) Launched Without 301 Redirects to New Pages - Too Late to Add Redirects?
          BeanstalkIM
          BeanstalkIM
          0
          8
          732

        • Domain switch planned - new domain accessible - until the switch: redirect from new to old domain with 307?
          comicron
          comicron
          0
          6
          144

        • Does it make sense to create new pages with friendlier URLs then redirect old pages to new?
          Keszi
          Keszi
          0
          3
          73

        • 301 redirect w/ dynamic pages to static
          TheDude
          TheDude
          0
          3
          529

        • Google penalized site--307/302 redirect to new site-- Via intermediate link—New Site Ranking Gone..?
          Robdob2013
          Robdob2013
          0
          5
          1.4k

        • We are changing ?page= dynamic url's to /page/ static urls. Will this hurt the progress we have made with the pages using dynamic addresses?
          h3counsel
          h3counsel
          0
          3
          806

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy