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
-
URL Formatting for Internal Link Tagging
After doing some research on internal campaign link tagging, I have seen conflicting viewpoints from analytics and SEO professionals regarding the most effective and SEO-friendly way to tag internal links for a large ecommerce site. It seems there are several common methods of tagging internal links, which can alter how Google interprets these links and indexes the URLs these links point to. Query Parameter - Using ? or & to separate a parameter like cid that will be appended to all internal-pointing links. Since Google will crawl and index these, I believe this method has the potential of causing duplicate content. Hash - Using # to separate a parameter like cid that will be appended to all internal-pointing links. Javascript - Using an onclick event to pass tracking data to your analytics platform Not Tagging Internal Links - While this method will provide the cleanest possible internal link paths for Google and users navigating the site and prevent duplicate content issues, analytics will be less effective. For those of you that manage SEO or analytics for large (1 million+ visits per month) ecommerce sites, what method do you employ and why? Edit* - For this discussion, I am only concerned with tagging links within the site that point to other pages within the same site - not links that come from outside the site or lead offsite. Thank you
Reporting & Analytics | | RobbieFoglia0 -
Google Analytics Page Metrics and Redirects
Hi All- Context: A site has been redesigned. Pages were renamed in the process. Problem: It's very hard to compare before and after metrics because the page URLs are not the same. Question: Anyone know how to do this in Google Analytics? I'm hoping there's some simple trick I just don't know about. D
Reporting & Analytics | | DonnaDuncan0 -
Webmaster Tools, why does it show 486 pages submitted to web, and only 40 indexed?
I am confused on what a client account shows in WMTs, client account is http://multiview.com. They have a graph showing 486 pages submitted to web, but only 40 are indexed. Also, they recently re-launched, i.e in April 2014, and the new site has about 40 pages indexed.... so I am guessing that the 486 number relates to all the pages that are showing errors in retrieving...i.e. 28 soft 404 errors, 10 access denied errors, 808 not found errors. Does this make sense to explain why there is such a gap between 486 and 40?
Reporting & Analytics | | DianeDP0 -
What type of links/redirect is Yahoo! using?
So I'm trying to figure out exactly what type redirect or hyperlinking Yahoo! is using on their article pages. For example:
Reporting & Analytics | | William.Lau
https://shopping.yahoo.com/blogs/fashionate/spring-clean-your-beauty-routine--10-tips-on-looking-fresh-this-season-000058218.html Hover over an external link, it shows you the ending URL. Right or left click it, it gives you a 302 redirect. When you actually left click it, it adds and "id" attribute, I assume for tracking. However, when you left click the the hyperlink, it no longer shows as a 302. I have limited working knowledge of web development techniques, so anyone with advance knowledge or have actually done this, it'd be helpful to understand this more.0 -
Images Getting Indexed Making for Low Engagements Times in GA
I have quite a few images that are being indexed for popular search terms and are getting clicks. This site has a 0-10 second engagement of 69%. I would like to eliminate these images from the equation because I tend to think they are hurting my "quality score" in organic Google rankings. How do you keep these images from ranking? I suppose I could rename them. Should I disallow the images folder? I hate to do that, because some of my images turn up in local searches, which is good. I would rather keep those. But what is best practice? A little background info, this is a local service site. So the images that are ranking are coming up for a broad national type search. This has 0 value for the site. Any advice or suggestions would be appreciated, Thanks! Kathy
Reporting & Analytics | | MSWD0 -
Analytics Filter for URL's
Hi Fellow Mozzers I am setting my analytics and need to set some filters and need some help. I have a number of Local Sites i need to include and can't find how to do it. some of the the paths are local.imsm.com/new-york/ local.imsm.com/chicago/ local.imsm.com/long-beach/ local.imsm.com/atlanta/ each of the local URL's are /name/ any help would be great
Reporting & Analytics | | imsmlouis0 -
URL-structure change - former long-tail traffic gone
Hey people, I'm sure many of you applied changes to the URL structure of a client's or your own website before. So did I for obvious reason: The structure before was like www.domain.com/brand_page/_22-key-word-translatedkeyword.php (ranked 20). This was changed to www.domain.com/key-word.html.
Reporting & Analytics | | dumperama
Edit: Also on-page it was optimized, but only taking out worthless links like "keyword-link to other page" and adding a relevant SEO text (also valuable for the user) Now, for the targeted short-tail keyword, the outcome was great - ranking increased by 17 landing the page on the first SERP. But: Before this page garnered a wide range of long-tail keyword traffic.To be exact: 2600 different keywords generated traffic for that page in a period of 1 month. Now the newly structured site (also on-page optimized) only receives traffic from around 100 keywords. You can imagine that the absolute amount of visits also dropped. So I'd like to know if you observed similar results. Another question that's coming up in this context: How regularly does Google refresh the keywords associated with a page? Like: Is this page really relevant for this one keyword we associated it with 5 years ago? Because it is clear, when I'm looking at the aforementioned 2600 KW in detail, most don't have anything to do with the site, i.e. are not mentioned at all. Still they generated valuable traffic though. All of this is really crucial to this project, because soon the whole website's supposed to be relaunched with optimized URL structure and of course everything else that's need SEO wise... I'd love to hear your experiences. Thanks!!0