Redirecting all URLs appended with index.htm or index.html
-
It has come to my attention with one of my clients (WordPress website) that for some time they have within their Landing Page report (of GA - Google Analytics) URLs that should all be pointing to the one page, example:
domain.com/about-us, also has a listing in GA as domain.com/about-us/index.htm
Is this some kind of indication of a subdirectory issue? Has anyone had experience with this in such wordpress plugins as Yoast SEO, or other SEO plugin?
My thoughts here are to simply redirect any of these non-existent files with a redirect in .htaccess - but what I'm using isn't working. I will insert the redirect here - - and any help would be greatly appreciated.
RewriteEngine onRewriteCond %{THE_REQUEST} ^./index.html?
RewriteRule ^(.)index.html?$ http://www.dupontservicecenter.com/$1 [R=301,L]and this rewrite doesn't work:
RewriteEngine on
RewriteRule ^(.+).htm$ http://dupontservicecenter.com/$1.php [R,NC]_Cindy
-
ThompsonPaul,
Thank you! I've looked at that feature so many times, and read and reread the info Google provided, and clearly reading this information literally, as someone at my level would, it really doesn't specify whether adding the default page "adds" index.htm(l) to the url and therefore combines all "same-pages" or if it removes it to combine "same-pages"
-- and I assumed the later since that is what happens with permalinks in WP... go figure. Now I realize it adds. Also it didn't occur to me that this feature wouldn't act as a filter would and you would see the results right away.
OK so I have removed "index.htm" from the default page field, it is all clear now. Additionally I am also showing appended to my url's an "index.html" -- and this is in addition the actual url. So I am seeing, for example:
/about-us/ /about-us/index.htm and in some cases urls like /about-us/index.html.
I can only guess that at one time both of these default urls were in the default page setting... "index.html" and "index.htm" And anyway these pages with index.htm(l) do not exist, ...which would explain that right, likely this issue concerns settings in GA
-
So one more perplexing issue - in the search console landing page report I am showing 0 hits for any url appended with either index.htm or index.html.
-
But in the regular reporting of landing pages, and also custom reporting, these pages are showing hits (pages appended w index.htm(l)). What could cause this discrepancy?
-
As you suggestion it would take a bit of filtering to clean up these url's in Google Analytics? And so if it is in Google Analytics then any redirect in the htaccess file is for naught?
-
So a several weeks, likely for this small business site, to begin showing clean urls and to see if this is actually this issue?
Thank you so very much!
_Cindy
-
-
Thomas, thank you for your help. I did occur to me that perhaps the order of items in the htaccess file may be the issue.
I am going to look into this issue - thanks to your suggestion, and then see if my redirects are working as they should.
When I do, I'll get back to you on this topic.
Now, I'm trying to wrap my mind around the issue of why "index.htm and index html" when my site is WP based and therefore a PHP framework. ThompsonPaul has responded with what was my next look (and actually a 4th to 8th look) concerning the default page setting in GA.
Thanks again.
_Cindy -
Cindy, this is almost certainly an issue with the way your Google Analytics is configured, not your WP site. (the fact the "index.htm" comes after a "/" is the clue.
If you check the View Settings link under the View in the Admin section of your dashboard, you'll find a field called Default Page. For most correctly configured modern sites (WP sites included), this field must be empty for GA to be configured correctly. I'm betting your config has index.htm entered in that field. [See screenshot below.]
Once you remove that entry, your data will avoid the problem going forward, but it will take some work with custom filters if you want to try to clean up the historical data.
Let me know if that solves the issue?
Paul
-
Are you able to copy out your whole htaccess?
I've got to admit, i'm not the best with it but I'll try and help you figure this out
-
Hi Thomas,
Very much appreciate your reponse.
So far none of the redirects are working, including your suggestion. So I tested the htaccess file with this redirect, changing one of the redirects already listed in the htaccess file for some time now, which use to work...
RewriteCond %{HTTP_HOST} ^dupontservicecenter.com/buying-and-selling$
RewriteRule ^$ http://dupontservicecenter.com/rewards/auto-service-credit [L,R=301]...not working, is redirecting to the old url, the one I changed.
I have purged cache (using litespeed cache for wp since I'm on a litespeed server these days). Could it be a purge issue? What would cause the htaccess file not to work properly?
The only redirect that is working is through a plugin for wp - quick redirects which uses the wp_redirect() function.
Totally lost in a haystack.
Any further suggestions would be helpful, otherwise, a complete, timely, breakdown of all website components will have to be proposed to the client.
_Cindy
-
https://mza.bundledseo.com/community/q/redirecting-index-html-to-the-root
StreamlineMetrics:
If you want to redirect all index.html(s) to their roots, then try this code -
RewriteEngine On
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]And yes, Google will treat them as 301 redirects so your juice will be transferred and consolidated.
Obviously, change index.html to index.htm
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
-
Mobile first indexing but can you force Google to index your desktop url instead?
Hi Guys So I just wanted to know if there is an option to force google to index your desktop version instead of the mobile version after the mobile first indexing by Google. Cheers Martin
Reporting & Analytics | | martin19700 -
URL Structure for Study Guides
I'm creating study guides for various musicals, plays and operas. A few issues: I want to easily view in Google Analytics data for all study guides, data at the category level (musical,play, opera) and data for an individual show. I want urls to be as short as possible for usability purposes. Some show titles are the same for shows in different categories. For example, there is the play Romeo and Juliet but there is also an opera Romeo and Juliet. Each study guide contains multiple sections that will live on different URLs (overview, context, plot summary, characters) What would be the ideal URL structure? Here's what I was currently thinking we should use: /show/play/romeo-juliet/ /show/play/romeo-juliet/context /show/play/romeo-juliet/plot /show/play/romeo-juliet/characters
Reporting & Analytics | | stageagent0 -
Find out who mentioned my URL on Facebook
I am seeing a big spike in traffic coming from Facebook. The referrer looks like this (at least sometimes, mostly it is just https://m.facebook.com or http://www.facebook.com/😞 http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.terminretter.de%2F&h=rAQGSwECjAQGiZFaVEkz7U2od1RNFVtxhVQNG__EujSznUw&s=1 Is there a way to know who shared my URL on facebook?
Reporting & Analytics | | cengelhardt0 -
Why is Google Analytics showing index.php after every page URL?
Hi, My client's site has GA tracking code gathering correct data on the site, but the pages are listed in GA as having /index.php at the end of every URL, although this does not appear when you visit the site pages. Even if there is a redirect happening for site visitors, shouldn't GA be showing the pages as their redirect destination, i.e. the URL that visitors actually see? Could this discrepancy be adversely affecting my search performance? Example page: http://freshstarttax.com/innocent-spouse/ shows up in GA as http://freshstarttax.com/innocent-spouse/index.php thanks
Reporting & Analytics | | JMagary0 -
"not selected" is gone from Google Webmaster Tools Index Status Advanced
Just noticed today that the "not selected" has been removed from the Index status, Advanced section of Google Webmaster Tools. Anyone know why. I've used this metric to determine how or why Google was not selecting pages, particularly to gauge canonical's, 301's and duplicate content. It will be missed if gone for good.
Reporting & Analytics | | tdawson090 -
Bing Won't Index Site - Help!
For the past few weeks I’ve been trying to figure out why my client's site is not indexed on bing and yahoo search engines. My Google analytics is telling me I’m getting traffic (very little traffic) from Bing almost daily but Bing webmaster tools is telling me I’ve received no traffic and no pages have been indexed into Bing since the beginning of December. At once point I was showing ranking in Bing for only one keyword then all of a sudden none of my pages were being indexed and I now rank for nothing for that website. From Google I’m getting over 1200 visits per month. I have been doing everything I can to possibly find the culprit behind this issue. I feel like the issue could be a redirect problem. In webmaster tools on Bing I’ve used “Fetch as Bingbot” and every time I use it I get a Status of “Redirection limit reached.”. I also checked the CRAWL Information and it’s saying all the URL’s to the site are under 301 redirect. A month or so ago the site was completely revamped and the canonical URL was changed from non www to www. I have tried manually adding pages to be indexed multiple times and Bing will not index any of the sites pages. I have submitted the sitemap to Bing and I am now at a loss. I don’t know what’s going on and why I can’t get the site listed on Bing. Any suggestions would be greatly appreciated. Thanks,
Reporting & Analytics | | VITALBGS
Stephen0 -
Godaddy 301 redirect
Hi, Happy Holidays to all! Although, this is not Thanksgiving, I am very thankful for becoming a member of this site. I ahve learned so much. Here is yet another question hping to have answered by the pundits of this SEOMOZ: I have a site built on site builder and hosted on Yahoo Hosting which does not allow 301 Redirects; I was fortunate enough to have someone help opn this site explain to me how to use Godaddy (they are my domain provide) to 301 through forwarding, work great! My http://domain.com now directs to www.domain.com , the only problem I am having now is, on :sitebuilder" the index page is classified as index.html, thus providing duplicate content again. Can you do two redirects through Godaddy? In othert words, my http://domain.com/ goes to www.domain.com/ eliminating duplicent content, but now I have another URL - http:..domain.com/index.html how do i get rid of that to prevent dup content. Any feed back would be great, Happy Holidays! Jimmy
Reporting & Analytics | | jimmy02250 -
Google Analytics: Do url redirects show up
Good Morning from 6 degrees c mostly cloudy wetherby UK 🙂 A redirect has been set up with the effect that when you key in www.hyload.co.uk it forwards to www.ikogroup.co.uk My question is please...within Google analytics will referall traffic from www.hyload.co.uk show up in referral traffic or because its a redirect will it be counted as direct traffic. Thanks in advance, David
Reporting & Analytics | | Nightwing0