Redirecting a working dynamic URI to a new static format
-
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 .phpRewriteEngine 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
-
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
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Replace dynamic paramenter URLs with static Landing Page URL - faceted navigation
Hi there, got a quick question regarding faceted navigation. If a specific filter (facet) seems to be quite popular for visitors. Does it make sense to replace a dynamic URL e.x http://www.domain.com/pants.html?a_type=239 by a static, more SEO friendly URL e.x http://www.domain.com/pants/levis-pants.html by creating a proper landing page for it. I know, that it is nearly impossible to replace all variations of this parameter URLs by static ones but does it generally make sense to do this for the most popular facets choose by visitors. Or does this cause any issues? Any help is much appreciated. Thanks a lot in advance
Intermediate & Advanced SEO | | ennovators0 -
Domain forward or 301 redirect
My company recently acquired another company including their web presence. We are soon ending their website and will be either 301 redirecting their domain to our domain or pointing their domain to our nameservers. Their domain authority is only 25 while our domain authority is 32. Their domain was created in 1998 while ours was created in 1999. So to keep our domain authority up or enhance it, should we do a 301 redirect or a domain forward. And that is if there is any difference? Thanks Chris
Intermediate & Advanced SEO | | topsailislander0 -
303 redirect
Hi, 303 redirect is a good thing or not ? I have a homepage in 2 languages FR and EN > mywebsite.com/fr/ and mywebsite.com/en/. A 303 redirect is on mywebsite.com to mywebsite.com/fr/. Thanks D.
Intermediate & Advanced SEO | | android_lyon0 -
301 redirects
Hello, I want to ditch about 1000 pages of a 2000+ page site. I believe the 301 redirect thing is the way to go but my expertise is limited. Is there a way to do a blanket redirect ie if a user or search engine looks for a page thats not there it all gets redirected to the index page or do I have to do each one manually? Thanks Ian
Intermediate & Advanced SEO | | jwdl0 -
Canonical or 301 redirect, that is the question?
So my site has duplicate content issues because of the index.html and the www and non www version of the site. What's the best way to deal with this without htaccess? Is it a 301 redirect or is it the canonical, or is it both?
Intermediate & Advanced SEO | | bronxpad0 -
Cookies and redirects - what are the negative effects?
I am advising a client who wants to streamline their online customers experience through the use of cookies. The first time someone visits mysite.com, they will visit the normal index page, and on that page will be asked to identify themselves as a Personal or Business customer - and taken through to a relevant page. This will result in a cookie being added. The next time they come back to mysite.com, the cookie will automatically direct them from the index page to mysite.com/personal/ or mysite.com/business/. My question is, what are the SEO implications of this, especially given the fact the index page is their primary landing page for almost all organic traffic? Bots I realise that googlebot etc do not store cookies, so this should result in no change from the bots perspective (i.e. no redirect) but is it that simple? In effect we'll be showing the bot one thing and second time + visitors something else. Is this not effectively cloaking? All advice gratefully received!
Intermediate & Advanced SEO | | seomasters0 -
301 Redirect - How Long Until Recovery?
How long after one moves a page and sets up the 301s should the site take to regain its previous rankings? Context: i've ported a site to a new framework. Along the way, several high ranked pages needed to have new URLs setup, as well as the site moved from www.domain.com to simply domain.com. About 1 week after the change, the site's traffic went down 70% and has been there for about another 2 weeks. I suppose it could be something about the new framework that is causing problems though according to SEOMoz tools, the new framework is checking out pretty well. I assume the problem is reconciling all those old www inbound links with the new non-www location. It is all 301'd however ... so it should be working, but is not. So my questions are: 1. How long should it take Google to reconcile these changes and put us back to original SERP positions 2. is there something inherently problematic with switching from www to non-www?
Intermediate & Advanced SEO | | NealCabage0 -
10,000 New Pages of New Content - Should I Block in Robots.txt?
I'm almost ready to launch a redesign of a client's website. The new site has over 10,000 new product pages, which contain unique product descriptions, but do feature some similar text to other products throughout the site. An example of the page similarities would be the following two products: Brown leather 2 seat sofa Brown leather 4 seat corner sofa Obviously, the products are different, but the pages feature very similar terms and phrases. I'm worried that the Panda update will mean that these pages are sand-boxed and/or penalised. Would you block the new pages? Add them gradually? What would you recommend in this situation?
Intermediate & Advanced SEO | | cmaddison0