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
-
Dynamic referenced canonical pages based on IP region and link equity question
Hi all, My website uses relative URLs that has PHP to read a users IP address, and update the page's referenced canonical tag to an region specific absolute URL for ranking / search results. E.g. www.example.com/category/product - relative URL referenced for internal links / external linkbuilding If a US IP address hits this link, the URL is the same, but canonicalisation is updated in the source to reference www.example.com**/us/**category/product, so all ranking considerations are pointed to that page instead. None of these region specific pages are actually used internally within the site. This decision was done so external links / blog content would fit a user no matter where they were coming from. I'm assuming this is an issue in trying to pass link equity with Googlebot, because it is splitting the strength between different absolute canonical pages depending on what IP it's using to crawl said links (as the relative URL will dynamically alter the canonical reference which is what ranking in SERPs) Any assistance or information no matter how small would be invaluable. Thanks!
Intermediate & Advanced SEO | | MattBassos0 -
301 Redirect from Authoritative but Loosely-Related Domain
We acquired a health-related blog about a year ago with good domain authority and a pretty strong link profile (TF ~40). We have been publishing good relevant content in it but it's not really paying dividends and we are considering doing a 301 to our money site, which is focused primarily on senior issues but has a lot of health-related content. The question is - with the two domains only being loosely related in subject matter, do we stand to harm our main site by redirecting from the other domain?
Intermediate & Advanced SEO | | sa_787040 -
Can I undo 301 redirects to purchase site
A website I am thinking of buying has 301 redirected all pages on his site to one page that explains the site is closing down. If I tell him to change the 301 to 302s will I be able to recover the old pages on the site and keep the authority, rankings and link power of the old pages and not the "Closing page"? Is all i have to do is undo the 301 redirects and everything will go back to how the site was before the 301s were in place? Or will I lose all the link power on individual pages because they already transferred to the "Closing page"? Thanks!
Intermediate & Advanced SEO | | atomiconline0 -
Multilingual Site and 301 redirection
Hey there awesome people of Moz I have this site that has many languages in it. The main language is English and my developer did the following www.example.com ( is the main site ) which redirects with a 301 to www.example.com/en if your geo location is supported by our languages then you will automatically be redirected to whatever language you have in your country but does the first language with is english have to 301 redirect to www.example.com/en ? I thought that the right way is to just leave /en at the root file. Thanks in advance
Intermediate & Advanced SEO | | Angelos_Savvaidis0 -
How do I best handle Duplicate Content on an IIS site using 301 redirects?
The crawl report for a site indicates the existence of both www and non-www content, which I am aware is duplicate. However, only the www pages are indexed**, which is throwing me off. There are not any 'no-index' tags on the non-www pages and nothing in robots.txt and I can't find a sitemap. I believe a 301 redirect from the non-www pages is what is in order. Is this accurate? I believe the site is built using asp.net on IIS as the pages end in .asp. (not very familiar to me) There are multiple versions of the homepage, including 'index.html' and 'default.asp.' Meta refresh tags are being used to point to 'default.asp'. What has been done: 1. I set the preferred domain to 'www' in Google's Webmaster Tools, as most links already point to www. 2. The Wordpress blog which sits in a /blog subdirectory has been set with rel="canonical" to point to the www version. What I have asked the programmer to do: 1. Add 301 redirects from the non-www pages to the www pages. 2. Set all versions of the homepage to redirect to www.site.org using 301 redirects as opposed to meta refresh tags. Have all bases been covered correctly? One more concern: I notice the canonical tags in the source code of the blog use a trailing slash - will this create a problem of inconsistency? (And why is rel="canonical" the standard for Wordpress SEO plugins while 301 redirects are preferred for SEO?) Thanks a million! **To clarify regarding the indexation of non-www pages: A search for 'site:site.org -inurl:www' returns only 7 pages without www which are all blog pages without content (Code 200, not 404 - maybe deleted or moved - which is perhaps another 301 redirect issue).
Intermediate & Advanced SEO | | kimmiedawn0 -
301 Redirect To Another 301 Redirect
Hi, We have a client with an old domain that they want to redirect to their primary domain. They also have a few older domains pointing to the old domain. Do you recommend leaving them as redirects that point to the old domain? This will create a redirect to a redirect situation. Or, is it better to go ahead and redirect those older domains to the primary one's, removing one layer of redirect? Thank you! Jessie
Intermediate & Advanced SEO | | JessieT0 -
Splitting one Website into 2 Different New Websites with 301 redirects, help?
Here's the deal. My website stbands.com does fairly well. The only issue it is facing a long term branding crisis. It sells custom products and sporting goods. We decided that we want to make a sporting goods website for the retail stuff and then a custom site only focusing on the custom stuff. One website transformed and broken into 2 new ones, with two new brand names. The way we are thinking about doing this is doing a lot of 301 redirects, but what do we do with the homepage (stbands.com) and what is the best practice to make sure we don't lose traffic to the categories, etc.? Which new website do we 301 the homepage to? It's rough because for some keywords we rank 3 or 4 times on the first page. Scary times, but something must be done for the long term. Any advise is greatly appreciated. Thank you in advance. We are set for a busy next few months 🙂
Intermediate & Advanced SEO | | Hyrule0 -
Duplicate titles but redirecting anyway (without redirects set up!!!)
Google has done a crawl of my site and is flagging up duplicate titles on my wordpress site. This appears to be due to the face that some posts are tagged in more than one category. I have just gone to make sure that each post just has one category and add redirects and I've noticed that all the duplicate title issues google has notified me about appear to redirect anyway. For example: http://www.musicliveuk.com/latest-news/live-music-boosts-australian-economy and http://www.musicliveuk.com/live-music/live-music-boosts-australian-economy have duplicate titles apparantly but the 1st url redirects to the 2nd one. I use the redirection plug in but have no redirection set up for that url so I'm a bit confused. And if they're redirecting anyway then why is google flagging up duplicate titles? Any help would be much appreciated.
Intermediate & Advanced SEO | | SamCUK1