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?
-
No problem! I'm curious what solution you are planning to choose and of course, if it helped you rank higher.. although that sort of data will only be available in a couple of months of course.
-
I'd agree that, theoretically, 301-redirects are better here, but if it's just the home-page, a canonical tag can definitely sweep up any problem duplicates. If you're getting www and non-www versions of multiple pages indexed, then you probably need 301s. I'd check the index with the site: operator and see. If you're really getting multiples of both indexed, you probably have internal linking issues (inconsistencies). Step 1 in any de-duplication is to make sure you're always linking to the same version. Same with "index.html" - link to "/" internally or the absolute URL of the site (without "index.html").
PHP (code-based) redirects should be fine, as long as they resolve correctly. I've used code-based headers in some other languages (like ColdFusion) and it's generally been ok. If that gets messy, though, and if it's just the home-page, the canonical tag will do in a pinch.
-
Thanks for your tips.
-
I would say 301 redirect. e.g. in PHP you can use:
/home.html to /
if ($_SERVER['REQUEST_URI'] == '/home.html') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: /');
}
non-www to www
**if ($_SERVER['SERVER_NAME'] == 'example.com') **{
header('HTTP/1.1 301 Moved Permanently');
header('Location: www.example.com' . $_SERVER['REQUEST_URI']);
}
Good luck!
-
what about using a php 301 redirect? is that also a good option? I'm looking for the simplest solution that doesn't mess up my seo efforts.
Thank you
-
Hi Joel!
Googles recommendation for this is a 301 redirect.
If you need to change the URL of a page as it is shown in search engine results, we recommended that you use a server-side 301 redirect.
More reading: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633
In other case, if you dont have access to do it server-side, then a canonical is better then nothing.
Good luck!
-
Hi Joel,
I'd say a 301 redirect using your HTaccess file is best. However, if you cannot access the htaccess file i'd go with the rel canonical. Otherwise you would be using meta refresh or javascript and the like, which are generally not appreciated by Google. Besides, if the page is truly a duplicate the canonical link tag usually does the trick anyway!
Good luck,
Sven Witteveen
Expand Online
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
-
Soft 404 error for a big, longstanding 301-redirected page
Hi everyone, Years ago, we acquired a website that had essentially 2 prominent homepages - one was like example.com and the other like example.com/htm... They served the same purpose basically, and were both very powerful, like PR7 and often had double listings for important search phrases in Google. Both pages had amassed considerable powerful links to them. About 4 years ago, we decided to 301 redirect the example.com/htm page to our homepage to clean up the user experience on our site and also, we hoped, to make one even stronger page in serps, rather than two less strong pages. Suddenly, in the past couple weeks, this example.com/htm 301-ed page started appearing in our Google Search Console as a soft 404 error. We've never had a soft 404 error before now. I tried marking this as resolved, to see if the error would return or if it was just some kind of temporary blip. The error did return. So my questions are:
Intermediate & Advanced SEO | | Eric_R
1. Why would this be happening after all this time?
2. Is this soft 404 error a signal from Google that we are no longer getting any benefit from link juice funneled to our existing homepage through the example.com/htm 301 redirect? The example.com/htm page still has considerable (albeit old) links pointing to it across the web. We're trying to make sense of this soft 404 observation and any insight would be greatly appreciated. Thanks!
Eric0 -
Flip-Flopping domains - 301 redirect question
We have a client who has had the following domain setup for some time: longdomain.com 301 -> shortdomain.com Now, they would like to go back to the original longdomain.com, and will have the following setup: shortdomain.com 301 -> longdomain.com Obviously, I'm concerned about redirect loops cached in the browser. I plan to have the 301's from longdomain.com changed over to 302's for two weeks ahead of the change, so that hopefully when the change happens, browsers and search engines are more ready to respond. I also plan to establish rel=canonical on the longdomain.com pages after the switch. Is there anything else you'd recommend to help with the changeover? Should we plan for an intermediary period were both domains are serving the content, so that the redirects can be purged, before being re-established the other direction? Thanks in advance.
Intermediate & Advanced SEO | | Bit-Wizards0 -
301 Redirect Showing Up as Thousands Of Backlinks?
Hi Everyone, I'm currently doing quite a large back link audit on my company's website and there's one thing that's bugging me. Our website used to be split into two domains for separate areas of the business but since we have merged them together into one domain and have 301 redirected the old domain the the main one. But now, both GWT and Majestic are telling me that I've got 12,000 backlinks from that domain? This domain didn't even have 12,000 pages when it was live and I only did specific 301 redirects (ie. for specific URL's and not an overall domain level 301 redirect) for about 50 of the URL's with all the rest being redirected to the homepage. Therefore I'm quite confused about why its showing up as so many backlinks - Old redirects I've done don't usually show as a backlink at all. UPDATE: I've got some more info on the specific back links. But now my question is - is having this many backlinks/redirects from a single domain going to be viewed negatively in Google's eyes? I'm currently doing a reconsideration request and would look to try and fix this issue if having so many backlinks from a single domain would be against Google's guidelines. Does anybody have any ideas? Probably somthing very obvious. Thanks! Sam
Intermediate & Advanced SEO | | Sandicliffe0 -
Rel Canonical Link on the Canonical Page
Is there a problem with placing a rel=canonical link on the canonical page - in addition to the duplicate pages? For example, would that create create an endless loop where the canonical page keeps referring to itself? Two examples that are troubling me are: My home site is www.1099pro.com which is exactly the same as www.1099pro.com/index.asp (all updates to the home page are made by updating the index.asp page). I want www.1099pro.com/index.asp to have the rel=canonical link to point to my standard homepage www.1099pro.com but any update that I make on the index page is automatically incorporated into www.1099pro.com as well. I don't have access to my hosting web server and any updates I make have to be done to the specific landing pages/templates. I am also creating a new website that could possible have pages with duplicate content in the future. I would like to already include the rel=canonical link on the standard canonical page even though there is not duplicate content yet. Any help really would be appreciated. I've read a ton of articles on the subject but none really define whether or not it is ok to have the rel=canonical link on both the canonical page and the duplicate pages. The closest explanation was in a MOZ article that it was ok but the answer was fuzzy. -Mike
Intermediate & Advanced SEO | | Stew2220 -
Multiple 301 Redirects on the same domain name
Hi, I'd appreciate some advice ont he below. I have a website, say www.site.co.uk that has just been redesigned using a new CMS. Previously it had URLs in the format /article.php?id=123, the new site has more friendly urls in the format /articles/article-slug. I have been able to import the old articles into my CMS using the same article IDs and I have created a unique slug for each post. So now in my database, I have the article id (from the querystring) and a slug. However, I have hundreds of old URLs indexed by Google in the format /article.php?id=123 and need to redirect these. My plan was to do the following. 301 Redirect /article.php?id=123 to an intermediate page, in this case /redirect/123. On this intermediate page I would do a database lookup for the article slug, based on the ID from the querystring, create a new URL and perform a second 301 redirect to my new URL E.g. /articles/article-slug-from-database. Whilst this works and keeps the site usable for visitors the two 301 redirects do worry me, as I don;t want Google indexing lots of /redirect/[article id] urls. The other solution is to generate hundreds of htaccess redirect rules that map old url to the new url. The first solution is much cleaner, but the two 301's worry me. Will Google work this out on it's own, is there a better way? Any advice is much appreciated. Cheers Rob
Intermediate & Advanced SEO | | AmyCrompton1 -
Confusing 301 / Canonical Redirect Issue - Wizard Needed
I had two pages on my site with identical content. What I did was 301 redirect one page to the other. I also added canonical redirect code to the page that held the 301 code. Here is what I have: www.careersinmusic.com/music-colleges.aspx - this page was a duplicate and I needed it to resolve to:
Intermediate & Advanced SEO | | 4Buck
www.careersinmusic.com/music-schools.aspx Here is the code I used: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX music-colleges.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="music-colleges.aspx.vb" Inherits="music_colleges" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml"> http://www.careersinmusic.com/music-schools.aspx"/> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
music-colleges.aspx.vb
Partial Class music_colleges
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", "http://www.careersinmusic.com/music-schools.aspx")
End Sub
End Class XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The problem:
For some reason, when the search “music colleges” is done in Google, I am #7. When the term “music schools” is done, I am around 119. I MUST be getting a penalty for some reason, I just cannot figure the reason. When perform well for one term and terrible for the next? All I can come up with is a duplicate content penalty or something along those lines. Also, music-colleges.aspx seems to still be in Googles index, even though the above 301 happened months ago. Thoughts? site:www.careersinmusic.com/music-colleges.aspx Any insight into this would be GREATLY appreciated. Many Thanks!0 -
Duplicate Content / 301 redirect Ariticle issue
Hello, We've got some articles floating around on our site nlpca(dot)com like this article: http://www.nlpca.com/what-is-dynamic-spin-release.html that's is not linked to from anywhere else. The article exists how it's supposed to be here: http://www.dynamicspinrelease.com/what-is-dsr/ (our other website) Would it be safe in eyes of both google's algorithm (as much as you know) and with Panda to just 301 redirect from http://www.nlpca.com/what-is-dynamic-spin-release.html to http://www.dynamicspinrelease.com/what-is-dsr/ or would no-indexing be better? Thank you!
Intermediate & Advanced SEO | | BobGW0 -
How To 301 Redirect .html pages
I need to redirect a page/URL that is purely .html to a new location. I don't know how to do this. All the redirects I can find are for server side code pages .php/.aspx etc. From my understanding I can't put a server side redirect in a .html file. I am hosting on a microsoft server, however the new page I am redirecting to is .php. I am running some WordPress (.php) files on the server. I need to make it redirect before the old page loads so visitors don't start reading something that is about to get redirected Can someone please help me?
Intermediate & Advanced SEO | | MyNet0