Htaccess - Redirecting TAG or Category pages
-
Hello Fellow Moz's,
We have an issue redirecting some /TAG and /Category pages to inner pages.
As an example we use:
RedirectMatch 301 /category/Sample-Category(.*) https://OurDomain.com.au/New-Page//$1
That works well.
The issue is we have other categories and tags that are named similar to /Sample-Category
As an example, if we try to redirect /Sample-Category-1 to /New-Page-1 - it will not work, and redirects to /New-Page
I assume this is because /Sample-Category is already being redirected, so anything after /Sample-Category like -1 or -2 or -3 etc, will not be recognized.
Anyone know of a workaround?
-
The regex in your RedirectMatch doesn't say what you think it says, Jes
This part (note the bolded part of the expression (.*)
/category/Sample-Category**(.*)**
doesn't actually say "match the URL that is specifically** /category/Sample-Category"**
That**.*** is a wildcard thatmeans "and any other additional characters that might occur here"
So what it's saying is "match the URL /category/Sample-Category _**as well as **_any URLs that have any additional characters after the letter "y" in category. Which is what is catching your -1 variation of the URL (or the -size-30 in your second example).
In addition, that wildcard has been set as a variable (the fact it's in brackets), which you are then attempting to insert into the end of the new URL (with the $1), which I don't think is your intent.
Instead, try:
RedirectMatch 301 /category/Sample-Category https://OurDomain.com.au/New-Page/
you should get the redirect you're looking for, and not have it interfere with the other ones you wish to write.
Let me know if that solves the issue? Or if I've misunderstood why you were trying to include the wildcard variable?
Paul
P.S. You'll need to be very specific whether the origin or target URLs use trailing slashes - I just replicated the examples you provided.
-
It's not as easy as that unfortunately.
I will reiterate.....If we redirect.....
RedirectMatch 301 /category/Blue-Shirts https://OurDomain.com.au**/Blue-Shirts**//$1 - it works, BUT....if we redirect another similar category page to different inner page like....
RedirectMatch 301 /category/Blue-Shirts-Size-30 https://OurDomain.com.au****/Blue-Shirts-Size-30****//$1 - it redirects to the first inner page example above.
That's why I was assuming it's not working because in the second example the sever sees /Blue-Shirts and ignores everything after it i.e the "Size-30".
Hopefully that makes it clearer?
-
If I've understood you correctly, all you need to do is to add a tag with the relevant content same as the old one.
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
-
Landing pages, are my pages competing?
If I have identified a keyword which generates income and when searched in google my homepage comes up ranked second, should I still create a landing page based on that keyword or will it compete with my homepage and cause it to rank lower?
Intermediate & Advanced SEO | | The_Great_Projects0 -
Several 301 Redirects to Same Page
Hi, I have 3 Pages we won't use anymore in our website. Let's call them url A, url B and url C. To keep their SEO strength on our domain, I've though about redirecting all of them to url D. For what I understand, when 301 redirecting, about 85-90% of the link SEO juice is passed. Then, if I redirect 3 URLs to the same page... does url D receive all the link SEO juices for URLs added up? (approximately)
Intermediate & Advanced SEO | | viatrading1
e.g. future url D juice = 100% current url D juice + 85% url A juice + 85% url B juice + 85% url C juice Is this the best practice, or is there a better way? Cheers,0 -
I currently have a canonical tag pointing to a different url for single page categories on eCommerce site. Is this wrong ?
Hi Mozzers, I have a query regarding canonical tags on my eCommerce site.. Basically on my category pages whereby I have more than 1 page, I currently use next/prev rel and also have a canonical tag pointing to the View all version of that page. This is believe is correct.(see example - http://goo.gl/2gz6LV However, from looking at the view source on my other pages, I have noticed I have canonical tags on all my category pages which are only a single page and these canonicaltag are pointing to a different url. I enclose an example . Please advise Category page - http://goo.gl/Pk4zYl This is where the canonical tag points to - http://goo.gl/EwKv26 Another example Category Page - http://goo.gl/4gWTdD This is where the canonical tag for that page points to http://goo.gl/qm4HV7 Should I either make sure that categories that are only 1 page , don't have a canonical tag at all ? or do I have a canonical tag on say every page on my website for safety pointing to the main url for that page. The later, I imagine would be a belt and braces approach but I don't want to screw up anything if it's not advised? Please help/ Kind regards Pete
Intermediate & Advanced SEO | | PeteC120 -
H3 Tags - Should I Link to my content Articles- ? And do I have to many H3 tags/ Links as it is ?
Hello All, On my ecommerce landing pages, I currently have links to my products as H3 Tags. I also have useful guides displayed on the page with links useful articles we have written (they currently go to my news section). I am wondering if I should put those article links as additional H3 tags as well for added seo benefit or do I have to many tags as it is ?. A link to my Landing Page I am talking about is - http://goo.gl/h838RW Screenshot of my h1-h6 tags - http://imgur.com/hLtX0n7 I enclose screenshot my guides and also of my H1-H6 tags. Any advice would be greatly appreciated. thanks Peter
Intermediate & Advanced SEO | | PeteC120 -
301 Externally Linked, But Non-Producing Pages, To Productive Pages Needing Links?
I'm working on a site that has some non-productive pages without much of an upside potential, but that are linked-to externally. The site also has some productive pages, light in external links, in a somewhat related topic. What do you think of 301ing the non-productive pages with links to the productive pages without links in order to give them more external link love? Would it make much of a difference? Thanks... Darcy
Intermediate & Advanced SEO | | 945010 -
Wordpress Tags vs. Categories(looking to restructure things)
Just looking for some advice on this topic. I know it's much debated but it seems the consensus is that having some broad categories and more defined tags is optimal. The issue with my site is that it is very broad in nature. We're profiling and interviewing all types of careers. The site is www.jobshadow.com for reference. Up until now I haven't used Wordpress Tags at all. I've just been using categories(i.e. 9-5 type jobs, salaried jobs, hourly jobs, jobs in medicine, etc). I've probably got way too many categories. They are being counted as links on every post page which pushes me way overboard on links per page. -Just curious if anyone has any thoughts on best practices for my site. -Also, none of the categories themselves are really pulling in any SEO traffic so switching those wouldn't be a big deal. Just looking for the best way to help users browse the site and the growing number of content. And rom what I hear Tags can pull in some random/long tail traffic pretty easily if done right. Look forward to hearing your thoughts. Thanks for the help!
Intermediate & Advanced SEO | | astahl110 -
Google Filter? Drop from top first page to bottom second page?
My site has dropped from the first page top spots to the bottom second page, about 2 month ago. From time to time it reappears in the first page, is this some kind of google filter? How do I solve this issue?
Intermediate & Advanced SEO | | Ofer230