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
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
-
Domain Name redirection to new Domain Name - VS - Transfering Domaine Name from account 1 to account 2
Hi there! Thanks for your time 😉 I have a new cutsomer that bought his domain name via WIX and your know... WIX sucks huge time for SEO. Basically, we want to do SEO outside of WIX. But I am not sure HOW I should proceed. I think I have 2 options: OPTION 1- We transfer the domain name from WIX to a new hoster. But we will lose 7 days during that, lose prospects while the website is in maintenance and we might lose the little bit of ranking we have on the way. BUT! ONCE Everything is done with the transfer, we will be able to operate our SEO campaing with a Domain Name that as 15 domain authority, links, little bit a ranking, etc. OPTION 2- I just buy a new domain name. I build the new Website on it and then use the SEO juice from the old domain name with redirect to push the new domain name. Like this, I won't lose any opportunities. BUT I will have to restart the SEO as new... Any tips or ideas for me? Maybe there is an OPTION 3 that I don't know about.
Intermediate & Advanced SEO | | Gab-SEO1 -
301 redirect with DNS?
Quick question. Is it possible to 301 redirect a non-www to www. (properly in terms of SEO) with DNS (C Name, A name, or other) ..have searched around and found conflicting information. Would like to know a definite answer. I usually implement all 301 redirects with htaccess. However have a client situation where we only have access to the CMS, but which does have DNS settings. thanks in advance, Greg
Intermediate & Advanced SEO | | GregDixson0 -
Redirect Plugin: Redirecting or Rewriting?
Hey everybody! It's been a while since off the boards! I am reworking a site and I have been looking into their Redirection Plugin. I personally tend to lean towards just using the .htaccess because, well, why not. However, when looking deeper into the plugin I found myself a little confused with their redirection wording. RewriteRule ^/products/landing-page-october-2015/$ /products/special-education-news-october-2015/ [R=301,L] Is that the same thing as a classic Redirect 301?
Intermediate & Advanced SEO | | HashtagHustler0 -
Setting up 301 Redirects after acquisition?
Hello! The company that I work for has recently acquired two other companies. I was wondering what the best strategy would be as it relates to redirects / authority. Please help! Thanks
Intermediate & Advanced SEO | | Colin.Accela0 -
Quick wins for new page
Hi! I recently put this page live for a new client targeting the term 'hospitality IT' in the UK. http://www.antana.co.uk/hospitality-IT.html I've done a bit of guest blog writing and the page is currently #10. There are very links to the site overall, and only a handful to the page itself. Should I focus on building links to the root domain or the page, and is there any other quick changes I can make to give it a boost? Thanks!
Intermediate & Advanced SEO | | neooptic0 -
What if a 301 redirect is removed?
Suppose the following scenarios after a 301 redirects from source URL to targent URL is removed. 1. If source URL raises a 404 error, will target URL retained the link juice previously passed from source URL? 2. If source URL starts to show different content than what is showing on target URL, will the previously passed link juice be credited back to the source URL?
Intermediate & Advanced SEO | | Bull1350 -
Best way to geo redirect
Hi I have a couple of ecommerce websites which have both a UK and USA store. At the moment I have both the UK and the USA domains sending me traffic from UK and USA search engines which means that a number of users are clicking a Google page for the store not in their location, ie UK people are clicking on a .com listing and ending up on the USA website. What is the best way to automatically redirect people to the correct store for their region? If I use an IP based auto redirect system would Google see some of the pages are doorway pages? Thanks
Intermediate & Advanced SEO | | Grumpy_Carl0 -
Pros and Cons of new subdomain and redirecting old subdomain?
Hi guys, I am thinking about redirecting the ranking subdoman to a new subdomain which has my main keyword within it. I am trying to outrank an exact match competitor and don't seem to be able to do so. For example: page.example.com would be my existing ranking URL which is very powerful, and I am thinking about redirecting this to a new URL being keywordpage.example.com What are your thoughts on do this? Thanks B
Intermediate & Advanced SEO | | HaymarketMediaGroupLtd0