Using Reg Ex to 301 old categories and query strings in Magento
-
Hi SEOmoz community!
I'm hoping somebody with a little Magento and Reg Ex knowledge will be able to help me out here.
I need to 301 some old categories along with their old query strings. Below is an example.
Old URL
/bed-linen/pillowcases-html.html
Users can then filter by price or range which then creates a query string such as...
/bed-linen/pillowcases-html.html?price=1%2C10
New URL:
/bed-linen/pillowcases.html
So the new query string will be
/bed-linen/pillowcases.html?price=1%2C10
Does anybody know the Reg Ex to 301 this? Can this be done in Magento re-write module or by htaccess only?
Thanks in advance
Anthony
@Anthony_Mac85
-
Thanks for taking the time to answer.
Yeh I mean regular expression, it's apache mod-rewrite and we use .htaccess
I'm struggling to figure out to 301 old url query strings to the new ones. There are several possible query strings for each product category so would take forever to do them one by one in magento re-write. The query strings will be the same i.e. ?price=1%2C10 but the category url will be different as you can see in my example above.
any ideas or do I need to hire an expert?
Thanks
-
I'd suggest checking with your host. I'm not sure if your reference to reg ex means "reg ex" in the sense of it being reforwarding software, or in the sense of using regular expressions to type syntax to handle it.
most hosts will have reforwarding software of some sort installed with their user accounts (the 301 thing is pretty common). once they let you know what it is (for example it might be apache's mod-rewrite or isapirewrite.com), you can figure out the format you need to write the rewrite commands in. some of them use IIS, some of them use .htacess, it all just depends.
if your old url and new urls are in respective "structures" you may also be able to put in wildcards to handle the directory words all at once.
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 Redirect from query string to new static page
If i want to create a redirect from a page where the slug ends like this "/?i=4839&mid=1000&id=41537" to a static, more SEO friendly slug like "/contact-us/", will a standard 301 redirect suffice? Thanks, Nails
Intermediate & Advanced SEO | | matt.nails0 -
What HREF should be used to target the market of the foreigners?
Usually, foreigners use a local computer (system language), on a local google but are searching in their native language for topics related with their native language. It's a mess for us and google it seems. In example, if a venezuelan person living in France (Paris), on a french AZERTY computer (not literally... 🙂 there is no such thing as a french computer), on Google.fr, search for a venezuelan arepa recipe using the keyword "receta arepa" in spanish of course, he is expecting the result to be in spanish. How could we optimize our pages with HREF or other tricks to rank as high as possible with that configuration? This is obviously just an example, but it represents the problem I am facing.
Intermediate & Advanced SEO | | rootsalad0 -
URL structure for categories, sub categories and products
Hi, I'm looking for some advice about URL hierarchy and the best way to structure URLs for SEO with regards to categories, sub categories and product pages. The way the site is set up displays the URLs as such, example: 1. /badge-accessories/ 2. /badge-accessories/plastic-wallets/ 3. /badge-accessories/plastic-wallets/clear-flexible-wallets/ I am questioning whether it would be best to keep it like this (which the site developers are suggesting) or change to something like: 1. /badge-accessories/ 2. /plastic-wallets/ 3. /clear-plastic-flexible-wallets/ Or something like: 1. /badge-accessories/ 2. /plastic-wallets/ 3. /plastic-wallets/clear-flexible-wallets/ Any advice would be appreciated. Thanks
Intermediate & Advanced SEO | | Kerry_Jones0 -
Ranking EMD to 301 for branding is it better to leave it as or 301 it?
We have a client about to enroll with us for SEO. The client has about 50 EMD sites, out of which 9 are ranking. An EMD has [Exact] match anchoring naturally, the sites in question are all EMDs the link profiles show it. The client wants to 301 the EMDs to a brand page.. We would want to 301, 9 EMD sites to the new site. Here is the thing, if the site domain has an exact match to the anchor text profile, when we 301 the page to www.brand.com/EMD will the link profile matter? One of the EMDs is on page one spot 2 if we do this change, will Google look at the new brand page (www.brand.com/EMD) as an unnatural link profile?
Intermediate & Advanced SEO | | Bryan_Loconto0 -
What redirect code (301,302,303) should I use for pages that are available only for logged in users?
If for example they go to a page like /premium-content, they will be automatically redirected (302) to the login page. Because now I do a 302 redirect, in Google Webmaster Tools it sais I have duplicate title issues for each of the pages that are accessible only for the logged in users. If I would do a 301 redirect, I basically tell Google that those pages are moved, but it is not the case because logged in users will see those pages.
Intermediate & Advanced SEO | | STEFANOAGBAGLA0 -
301 Redirect question
Which is the best way to set up the 301 redirect on my main home page? http://horsebuggy.com to http://www.horsebuggy.com Or does it make a difference? Boodreaux
Intermediate & Advanced SEO | | Boodreaux0 -
Old pages still crawled by SE returning 404s. Better to put 301 or block with robots.txt ?
Hello guys, A client of ours has thousand of pages returning 404 visibile on googl webmaster tools. These are all old pages which don't exist anymore but Google keeps on detecting them. These pages belong to sections of the site which don't exist anymore. They are not linked externally and didn't provide much value even when they existed What do u suggest us to do: (a) do nothing (b) redirect all these URL/folders to the homepage through a 301 (c) block these pages through the robots.txt. Are we inappropriately using part of the crawling budget set by Search Engines by not doing anything ? thx
Intermediate & Advanced SEO | | H-FARM0 -
Canonical, 301 or code a workaround?
Hi, Recently I've been trying to tackle an issue on one of my websites. I have a site with around 400 products and 550 pages total. I've been pruning some weaker pages and pages with shallow content, and it's been working really well. My current issue is this: There are about 20 store brands of 6 products on my site that each have their own page. They are identical products just re-branded. Writing content for each of these pages has been difficult, as it's a fairly dry product too. So I have around 120 pages of dry content that is unique but not much different from one another. I want to consolidate but I am not sure how yet. Here is what I am thinking: 1. 301 - I pick one product page as the master, 301 all the other duplicate products to it and then make one page of great content that encompasses all of them. If the 301 juice gets diluted over time I might miss out on some long tails, but I could also gain a lot more from a great content page with 500+ words of really good content as opposed to pages with 150-250 words of just so so content. 2. Canonical - Similar to above. I pick a master page and canonical the other pages to it. Then I could use the great content on all the pages, and still have pages for the specific products. The pages might not show up in search engines but would still be searchable on my site. 3. Coded solution - In my CMS I could always make a workaround where the products still appear on the brands page (just their name with a link to the product page) but all the links direct to a master page. I realize all the solutions are fairly similar, although I am not sure which is ideal. Option 3 is the most expensive/time consuming but it would drop my page total down to around 450 pages. For a while now (dating back to before Panda) I've been trying to get rid of the low quality and outdated product pages so I could focus on the more popular and active pages. Dropping my page total would also help in the SEO efforts as the sheer volume of pages that need links right now is high, and obviously the less pages I have the more time I can spend on each page (content and link building). So what do you think? Should I do any of the 3, a combination of the 3 or something different? Cheers, Vinnie
Intermediate & Advanced SEO | | vforvinnie0