Rel="canonical" What if there is no header??
-
Hi Everyone!
Thanks to moz.com, I just found out that we have a duplicate content issue: mywebsite.com and mywebsite.com/index.php have the same content. I would like to make mywebsite.com the main one because it already has a few links and a better page rank.
I know how to do a 301 redirect (already have one for www.mywebsite.com) but I am aware that a 301 redirect for my index file would create a loop issue. I have read the article about redirecting without creating a loop (http://moz.com/blog/apache-redirect-an-index-file-to-your-domain-without-looping) but quite frankly I don't even have a clue what he's trying to tell me (e.g. "Create an apache DirectoryIndex directive for your document root." What????!)… So I figured a rel="canonical" tag for my index file would be easier and fix the problem, too (right??)
In every "How to" description they always say you have to put the rel="canonical" tag in the header of your duplicate content file. But: My index.php has no header (or nothing that looks like a header to me)! This is what it looks like:
foreach($_GET as $key => $value)
{
$$key = $value;
}
foreach($_POST as $key => $value)
{
$$key = $value;
}
$page_title="my title";
$page_description="my description";
$page_keywords="keywords";
//echo $link;
//exit;
if (!isset($link)):
$page_content="homepage.php";
else:
if ($link=="services"):
$page_content="services.php";
$page_title=" my title for services page";
$page_description="description for services.";
endif;
… ect. for the other pagesSo where do I put the rel=canonical tag?
Or is there another solution for the whole problem? Like delete the whole index file (lol)
Thanks in advance for any answers!
-
Just fyi and for anyone who might be interested: That was the solution! I put the rel=canonical tag in the homepage header and my duplicate page content problem was gone!
Thanks!!!
-
You are right about the site dynamically creating pages. But the only one with the duplicate content issue is the homepage. I only need a rel=canonical tag for this one
Unfortunately contacting the people who originally wrote the code for the website and have them make changes is not an option
I will either have to figure this out on my own or find someone who can help me
-
Sounds like you've got a php site that's dynamically creating pages. You have to find the person who wrote the script and have them edit the template to add a canonical tag that inserts the correct url when the page is generated. Your not going to be able to insert a static canonical tag.
-
Hi Martijn!
Yes there is a header in my homepage.php file. Does that help? I thought the rel=canonical tag has to go in the file you want to "redirect"?
-
What is in your homepage.php file? It sounds like there could be a header from the code snippet that you've copied in.
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
-
Rel=canonical Weebly
My problem is with my website as it says I have duplicate page titles and contents because of a /index.html. It says the duplicate content is due to the fact that my homepage on my website is www.seacandytackle.com but it is also www.seacandytackle.com/index.html because I use weebly. How can I use the tag to fix this? It won't let me do a 301 redirect because it is a home page. How can I fix this? What code would I have to use and which url? Also it says that I have duplicate page content between http://www.seacandytackle.com/index.html and http://www.seacandytackle.comhttp://www.seacandytackle.com but I don't recall having any page that looks like http://www.seacandytackle.com http://www.seacandytackle.com from weebly. How can I fix this issue as well? Thank you for any help. Step by step implementation would be particularly helpful in using the rel= tags to fix these duplicate issues.
Technical SEO | | SeaCandyTackle0 -
Rel=canonical - Identical .com and .us Version of Site
We have a .us and a .com version of our site that we direct customers to based on location to servers. This is not changing for the foreseeable future. We had restricted Google from crawling the .us version of the site and all was fine until I started to see the https version of the .us appearing in the SERPs for certain keywords we keep an eye on. The .com still exists and is sometimes directly above or under the .us. It is occasionally a different page on the site with similar content to the query, or sometimes it just returns the exact same page for both the .com and the .us results. This has me worried about duplicate content issues. The question(s): Should I just get the https version of the .us to not be crawled/indexed and leave it at that or should I work to get a rel=canonical set up for the entire .us to .com (making the .com the canonical version)? Are there any major pitfalls I should be aware of in regards to the rel=canonical across the entire domain (both the .us and .com are identical and these newly crawled/indexed .us pages rank pretty nicely sometimes)? Am I better off just correcting it so the .us is no longer crawled and indexed and leaving it at that? Side question: Have any ecommerce guys noticed that Googlebot has started to crawl/index and serve up https version of your URLs in the SERPs even if the only way to get into those versions of the pages are to either append the https:// yourself to the URL or to go through a sign in or check out page? Is Google, in the wake of their https everywhere and potentially making it a ranking signal, forcing the check for the https of any given URL and choosing to index that? I just can't figure out how it is even finding those URLs to index if it isn't seeing http://www.example.com and then adding the https:// itself and checking... Help/insight on either point would be appreciated.
Technical SEO | | TLM0 -
Which forum platform has the best "SEO Functionality"?
I have used vBulletin with vBSEO for a number of years and have been happy with the SEO results that I have achieved. However, vBulletin's recent releases have become unstable, full of bugs and are not secure. I am intending on starting some new forums in the near future and would like to move away from vBulletin. I have heard good things about Xenforo and IP Boards. Does anybody have any experience with either platforms built in SEO functionality?
Technical SEO | | statman870 -
REL CANONİCAL
Hi, The Original Page: http://www.enakliyat.com.tr/evden-eve-nakliyat-firmalari/ Page 2: http://www.enakliyat.com.tr/evden-eve-nakliyat-firmalari/?sayfa=2 Page 3: http://www.enakliyat.com.tr/evden-eve-nakliyat-firmalari/?sayfa=3 Page 4:http://www.enakliyat.com.tr/evden-eve-nakliyat-firmalari/?sayfa=4 we added this rel="canonical" href="http://www.enakliyat.com.tr/evden-eve-nakliyat-firmalari/" /> tag all these pages Is it right?
Technical SEO | | iskq0 -
"INDEX,FOLLOW" then later in the code "NOINDEX,NOFOLLOW" which does google follow?
background info: we have an established closed E-commerce system which the company has been using for years. I have only just started and reviewing the system, I don't have direct access to the code, but can request changes, but it could take months before the changes are in effect (or done at all), and we won't can't change to a new E-commerce system for the short to mid term. While reviewing the site (with help of seomoz crawl diagnostics) I noticed that some of the existing "landing pages" have in the code: <meta name="<a class="attribute-value">robots</a>" content="<a class="attribute-value">INDEX,FOLLOW</a>" /> then a few lines later <meta name="<a class="attribute-value">robots</a>" content="<a class="attribute-value">NOINDEX,NOFOLLOW</a>" /> Which the crawl diagnostics flagged up, but in the webmaster tools says
Technical SEO | | PaddyDisplays
"We didn't detect any issues with non-indexable content on your site." so the question is which instructions does google follow? the first or 2nd? note: clearly this is need fixed, but I have a big list of changes for the system so I need to know how important this is tthanks0 -
Is the seomoz on-page factor :Appropriate Use of Rel Canonical working properly?
I have a word press site with a rel canonical plug in. The rel="canonical" href= is there and the url in there works and goes to the actual page.So why does the seomoz keep giving the warning: Appropriate Use of Rel Canonical
Technical SEO | | CurtCarroll0 -
Rel=canonical issue
Re. http://www.appetise.com. We have been alerted that we are "not making appropriate use of the rel=canonical tag". Please could someone just clarify this for us and let us know the recommended remedial action we need to take to rectify the issue? Many Thanks, RB
Technical SEO | | E-resistible0 -
Video thumbnail pages with "sort" feature -- tons of duplicate content?
A client has 2 separate pages for video thumbnails. One page is "popular videos" with a sort function for over 700 pages of video thumbnails with 10 thumbnails and short desriptions per page. (/videos?sort_by=popularity). The second page is "latest videos" (/videos?sort_by=latest) with over 7,000 pages. Both pages have a sort function -- including latest, relevance, popularity, time uploaded, etc. Many of the same video thumbnails appear on both pages. Also, when you click a thumbnail you get a full video page and these pages appear to get indexed well. There seem to be duplicate content issues between the "popular" and "latest" pages, as well as within the sort results on each of those pages. (A unique URL is generated everytime you use the sort function i.e. /videos?sort_by=latest&uploaded=this_week). Before my head explodes, what is the best way to treat this? I was thinking a noindex,follow meta robot on every page of thumbnails since the individual video pages are well indexed, but that seems extreme. Thoughts?
Technical SEO | | 540SEO0