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
-
Is <title>different from <h1> and "meta tag title"?</title>
hi guys, new to MOZ and SEO. Basic question here. is <title>different from <h1> and "meta tag title"?</p> <p>I have lots of "title missing or blank" errors as reported by a recent Moz crawl. What do i need to add into the pages to clear these? an <h1>? an <title>? or <meta tag title>? </p> <p>Im running a volusion site, and from what ive read (negative & positive) Volusion can be a pain to optimize my SEO as i dont have full access to all my pages.?</p></title>
Technical SEO | | Jerrion0 -
Magento Dublicate Content (Noindex and Rel"canonical")
Hi All, Just looking for some advice regarding my website on magento. We by mistake didnt enable canonical tags and noindex tags so had a big problem with dublicate content from filter pages but also have URLs to Cats as Yes so this didnt help with not having canonical tags enabled. We now have everything enabled for a few weeks now but dont see much drop in indexed pages in google. (currently 27k and we have only 5k products) My question basically is how do we speed up noindexation of dublicate content and also would you change URL to cats as No so google just now sees the url to products? (my concerns with this is would leaving it to Yes help because it will hopefully read the canonical tags on products now) Thank you in advance Michael
Technical SEO | | TogetherCare0 -
Does using data-href="" work more effectively than href="" rel="nofollow"?
I've been looking at some bigger enterprise sites and noticed some of them used HTML like this: <a <="" span="">data-href="http://www.otherodmain.com/" class="nofollow" rel="nofollow" target="_blank"></a> <a <="" span="">Instead of a regular href="" Does using data-href and some javascript help with shaping internal links, rather than just using a strict nofollow?</a>
Technical SEO | | JDatSB0 -
301s vs. rel=canonical for duplicate content across domains
Howdy mozzers, I just took on a telecommunications client who has spent the last few years acquiring smaller communications companies. When they took over these companies, they simply duplicated their site at all the old domains, resulting in a bunch of sites across the web with the exact same content. Obviously I'd like them all 301'd to their main site, but I'm getting push back. Am I OK to simply plug in rel=canonical tags across the duplicate sites? All the content is literally exactly the same. Thanks as always
Technical SEO | | jamesm5i0 -
Moz Crawl Reporting Duplicate content on "template" styled pages
We have a lot of detail pages on our site that reference specific scholarships. Each page has a different Title and Description. They also have unique information all regarding the same data points. The pages are displayed in a similar structure to the user so the data is easy to read. My problem is a lot of these pages are being reported as duplicate content when they certainly are not. Most of them are reported as duplicates when they have the same sponsor. They may have the same contact information listed. These two are being reported as duplicate of each other. They share some data but they are definitely different scholarships. http://www.collegexpress.com/scholarships/adelaide-mcclelland-garden-club-scholarship/9254/ http://www.collegexpress.com/scholarships/mary-wannamaker-witt-and-lee-hampton-witt-memorial-scholarship/10785/ Would it help to add a Canonical for each page to themselves? Any other suggestions would be great. Thanks
Technical SEO | | GeorgeLaRochelle0 -
Should we use "and" or "&"?
Our client has an ampersand in their brand name. The logo has "&", their url is spelled out. I'm trying to get them to standardize the use of the name for directories/listings. Should we use "and" or "&"?
Technical SEO | | vernonmack0 -
Different levels of PA without "www"?
Hello Guy´s! The last days I have been surprised to see that the levels of PA, mR, and mT vary when it is or not the "www" in the URL: 1. http://patagonline.com/viajes-argentina 2. http://www.patagonline.com/viajes-argentina Both URL's correspond to the keyword "viajes Argentina" our incoming links... In this case, it´s convenient to do a 301redirect from URL 1 to 2? Thanks a lot for your help!!
Technical SEO | | maty0 -
Canonical pagination content
Hello We have a large ecommerce site, as you are aware that ecommerce sites has canonical issues, I have read various sources on how best to practice canonical on ecommerce site but I am not sure yet.. My concert is pagination where I am on category product listing page.. the pagination will have all different product not same however the meta data will be same so should I make let's say page 2 or 3 to main category page or keep them as is to index those pages? Another issue is using filters, where I am on any page and I filter by price or manufacturer basically the page will be same so here It seems issue of duplicate content, so should I canonical to category page only for those result types? So basically If I let google crawl my pagination content and I only canonical those coming with filter search result that would be best practice? and would google webmaster parameter handling case would be helpful in this scenario ? Please feel free to ask in case you have any queries regards
Technical SEO | | CNMOnline28
Carl0