Rel canonical or 301 the Index Page?
-
Still a bit confused on best practice for /index.php showing up as duplicate for www.mysite.com. What do I need to do and How?
-
Hi! I'm following up on older questions, and wondering if you got this straightened out or still need a hand. Thanks!
-
I would recommend Barry's original solution as not only does it fix the issue you mentioned, it takes care of a couple of other potential duplicate content issues (slashes elsewhere and www vs non-www)
Marcus's solution should be fine if want to fix the one issue on the single page.mentioned.
-
You do get small variations in how the server wants the htaccess but give it a go and see if it works.
If you are happy it is working in the browser then there is a free bit of software called webbug that will let you see the HTTP headers to ensure you are getting the 301 permanent redirect returned.
Hope it helps.
-
Theoretically should work; you can quickly try it to see and change it back if it doesn't work
Doing it your way I've had sites fall over a few times (white page of death), but changing it back fixes things in no time.
-
so just adding this in should work too right?
redirect 301 /index.php http://www.mysite.com/
I have this already:
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] -
Probably the simplest way is to put this in your .htaccess file
RewriteEngine On Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.example.com/$1 [R=301,L]For reference the .htaccess file goes in the root of your domain via whatever file transfer program you use and of course replace example.com with your domain
This also makes sure the non-www redirects to the www.
If you get stuck, let me know
-
Add a canonical URL of www.mysite.com to the homepage (/ & /index.php) & 301 redirect www.mysite.com/index.php to www.mysite.com
That covers both bases and will see the content indexed on the correct page before too long.
Cheers
Marcus
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
-
Over 40+ pages have been removed from the indexed and this page has been selected as the google preferred canonical.
Over 40+ pages have been removed from the indexed and this page has been selected as the google preferred canonical. https://studyplaces.com/about-us/ The pages affected by this include: https://studyplaces.com/50-best-college-party-songs-of-all-time-and-why-we-love-them/ https://studyplaces.com/15-best-minors-for-business-majors/ As you can see the content on these pages is totally unrelated to the content on the about-us page. Any ideas why this is happening and how to resolve.
Technical SEO | | pnoddy0 -
Rel=Canonical For Landing Pages
We have PPC landing pages that are also ranking in organic search. We've decided to create new landing pages that have been improved to rank better in natural search. The PPC team however wants to use their original landing pages so we are unable to 301 these pages to the new pages being created. We need to block the old PPC pages from search. Any idea if we can use rel=canonical? The difference between old PPC page and new landing page is much more content to support keyword targeting and provide value to users. Google says it's OK to use rel=canonical if pages are similar but not sure if this applies to us. The old PPC pages have 1 paragraph of content followed by featured products for sale. The new pages have 4-5 paragraphs of content and many more products for sale. The other option would be to add meta noindex to the old PPC landing pages. Curious as to what you guys think. Thanks.
Technical SEO | | SoulSurfer80 -
Inner pages of a directory site wont index
I have a business directory site thats been around a long time but has always been split into two parts, a subdomain and the main domain. The subdomain has been used for listings for years but just recently Ive opened up the main domain and started adding listings there. The problem is that none of the listing pages seem to be betting indexed in Google. The main domain is indexed as is the category page and all its pages below that eg /category/travel but the actual business listing pages below that will not index. I can however get them to index if I request Google to crawl them in search console. A few other things: I have nothing blocked in the robots.txt file The site has a DA over 50 and a decent amount of backlinks There is a sitemap setup also any ideas?
Technical SEO | | linklander0 -
Does Google index internal anchors as separate pages?
Hi, Back in September, I added a function that sets an anchor on each subheading (h[2-6]) and creates a Table of content that links to each of those anchors. These anchors did show up in the SERPs as JumpTo Links. Fine. Back then I also changed the canonicals to a slightly different structur and meanwhile there was some massive increase in the number of indexed pages - WAY over the top - which has since been fixed by removing (410) a complete section of the site. However ... there are still ~34.000 pages indexed to what really are more like 4.000 plus (all properly canonicalised). Naturally I am wondering, what google thinks it is indexing. The number is just way of and quite inexplainable. So I was wondering: Does Google save JumpTo links as unique pages? Also, does anybody know any method of actually getting all the pages in the google index? (Not actually existing sites via Screaming Frog etc, but actual pages in the index - all methods I found sadly do not work.) Finally: Does somebody have any other explanation for the incongruency in indexed vs. actual pages? Thanks for your replies! Nico
Technical SEO | | netzkern_AG0 -
301: Dynamic URL to Static Page
I've been going around trying to get this dynamic url to redirect in the .htaccess file. I know I'm missing something but can't figure it out. Code: RewriteEngine on
Technical SEO | | ohlmanngroup
RewriteCond %{QUERY_STRING} ^/dynamic-url.php?id=43$
RewriteRule ^$ http://static/page/url/inserted/here? [R=301,L] Suggestions?0 -
How to determine which pages are not indexed
Is there a way to determine which pages of a website are not being indexed by the search engines? I know Google Webmasters has a sitemap area where it tells you how many urls have been submitted and how many are indexed out of those submitted. However, it doesn't necessarily show which urls aren't being indexed.
Technical SEO | | priceseo1 -
Index page 404 error
Crawl Results show there is 404 error page which is index.htmk **it is under my root, ** http://mydomain.com/index.htmk I have checked my index page on the server and my index page is index.HTML instead of index.HTMK. Please help me to fix it
Technical SEO | | semer0 -
301 redirect from root to /index.aspx
I have taken over the SEO for www.domain.net. The way i've inherited the setup is that www.domain.net is 301 redirected to www.domain.net/index.aspx Looking at top pages and linking root domains in Opensiteexplorer I can see that www.domain.net/index.aspx has 1,006 linking root domains www.domain.net has 806 linking root domains. I assume that www.domain.net is passing the value of it's 806 domain links to www.domain.net/index.aspx via the 301 redirect and because of this would expect www.domain.net/index.aspx to be the strongest page on the site and be the url that ranks in the listings for many relevant searches. It appears however that www.domain.net is what is shown in listings and not www.domain.net/index.aspx ?? Can anyone explain why this might be?? If I do a site: search in Google then www.domain.net is indexed and not www.domain.net/index.aspx ??
Technical SEO | | QubaSEO0