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
-
301 redirects and impact on page authority
I need to restructure a section of my website, changing some page titles and moving some pages to other sections. This will then change the URLs but the CMS I use will automatically create 301 redirects so the old URLs still work. The question is, will this have any negative impacts on page authority/page rank? From what I've read, it seems having 301's used to have a negative impact but doesn't anymore?
Intermediate & Advanced SEO | | ciehmoz0 -
Moving to new platform
I am moving a site with great SEO and tons of pages to a new platform. Page names will all be different because they will not have the .html ending and names will change. It is on a system that does not support .htaccess. So, I don't have a way to do 301 redirects. How can I keep my competitive status? Thank you!!
Intermediate & Advanced SEO | | bhsiao0 -
Pages that did NOT 301 redirect to the new site
Hi, Is there a tool out there that can tell me what pages did NOT 301 redirect to the new sites? I need something rather than going into google.com and typing in site:oldsite.com to see if it's still indexed and if it's not 301 redirecting.. I'm not sure if screaming frog can do that. Thanks.
Intermediate & Advanced SEO | | ggpaul5620 -
Keyword rank and redirecting
I'm creating a new amazon affiliate site. I've researched other successful sites. I've noticed that they are ranking for 1000s of keywords, but many of these long tail keywords are redirected back to a main page. I can see how this can reduce the overall total amount of content pages on the site. How are you able to rank for the keyword in the first place if the the page is redirected?
Intermediate & Advanced SEO | | lkomontt760 -
Dynamic pages
Hello Team, How can we create dynamic pages or more pages on website but maintaining SEO standards.
Intermediate & Advanced SEO | | Obbserv0 -
Launching a new site with old, new and updated content: What’s best practice?
Hi all, We are launching a new site soon and I’d like your opinion on best practice related to its content. We will be retaining some pages and content (although the URLs might change a bit as I intend to replace under-scores with hyphens and remove .asp from some extensions in order to standardise a currently uneven URL structuring). I will also be adding a lot of new pages with new content, along with amend some pages and their content (and amend URLs again if need be), and a few pages are going to be done away with all together. Any advice from those who’ve done the same in the past as to how best to proceed? Does the URL rewriting sound OK to do in conjunction with adding and amending content? Cheers, Dave
Intermediate & Advanced SEO | | Martin_S0 -
301 redirect help
Hey guys, I normally work in WordPress and just use a 301 redirect plugin. I bought a site and rather than maintain two similar ones have decided to redirect one to the other. I am having trouble with the .htaccess file. Here is an example. These are two redirects: redirect 301 /category/models/next/2
Intermediate & Advanced SEO | | DanDeceuster
redirect 301 /category/models I want both of these URLs to redirect to the same URL of the new site. However, the /category/models is the only one working. It redirects to the new page just fine. The /category/models/next/2 is redirecting to nearly the same URL on the new site, only it is adding /next/2 to the end and that is bringing up a 404. Why is it adding /next/2 to the new URL? How can I fix this? There are several doing this. Help appreciated!0 -
Redirects/Forwarding
I have two niche e-commerce sites. One is a PR3 with 3K pages indexed, the other is PR0 with 5K pages indexed. Each site has a blog that has been updated regularly. They both rank well for some fairly competitive keywords and some good links pointing to them. I also have a main site that is PR3. I am thinking of closing down the sites because they are not generating enough revenue, here are my questions: What is the best way to get the most SEO value from these sites? Do I just do a redirect to the main site? Should I keep the sites and use canonical URLs to the main site? Should I keep the domain as a wordpress blog and point links to the main site? What should I do with the blogs? They are on sub-domains, neither has pagerank. Thanks
Intermediate & Advanced SEO | | inhouseseo0