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://moz.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
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
-
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 are the consequences of doing a 301 redirect?
Just recently we did a redirection from a website that is ranking very well. The redirection was done through redirecting the page of the website A to the related page of website B. Website B raked massive traffic in the first week and have increased its ranking among Google searches but recently the traffic seems to decline. Website A which was ranking very well before redirection is now nowhere to be found on Google search. Is this a consequence of doing redirection? Please help.
Reporting & Analytics | | ISMEPTYLTD-SEOMOZ0 -
Analytics not tracking traffic from Old Domain Redirect
We've recently 301 redirected one of our client's domains to their new website and the strange thing is, we aren't seeing an increase in traffic in analytics. You would expect the traffic to increase roughly by the traffic volume from the old domain. There were a few hundred redirects and we tested a large sample and the redirects have been implemented properly. Is there something that we did incorrectly in our implementation of the domain redirect? Or is there something else that we need to do in Analytics to properly track those redirects?
Reporting & Analytics | | ATMOSMarketing560 -
Problem: Google web master tools with HTML Improvements
Hello, When using the google webmaster tools, on Optimization --> HTML Improvements, I have some problems in field the Short meta descriptions. This is easy to fix and I fixed some last days, then today I check this again. Google webmaster tool still report these errors. Please let me know how to notify to google, these errors was fixed?
Reporting & Analytics | | JohnHuynh0 -
What is the SEO Impact of Adding a Directory to URL
I would like to add a new directory named “products” for all of the product detail pages on my site. Instead of having the URL for a product be “mysite.com/product-details-page.aspx” we would like to change it to “mysite.com.com/products/product-detail-page.aspx.” I want to do this to enable us to add product pages to our traffic funnel analysis by filtering visits to the "product" directory - right now we can't track visits to product pages in the funnel because they are just one-off the main site. I know this change will require redirects for every single product. Is there anything else that needs to be done? My main question is, will this change negatively impact the SEO value of the product pages? We have several product pages ranking in the SERPs, and I don't know if pushing them one directory further will change that. Thanks for your input!
Reporting & Analytics | | pbhatt0 -
Will Bing/Google's engine index a page that has only been on social media?
Will Bing's engine index and rank a page that has only been seen on social media and has no inbound links? Will Google's? Are inbound links absolutely required to get a page indexed and ranking and getting traffic? If unknown, how would you go about testing this?
Reporting & Analytics | | SarahGoliger0 -
Historical Indexation
Hello, Is there at tool to see how many pages were indexed in google for a particular website historically? Thanks
Reporting & Analytics | | soeren.hofmayer0 -
URL Structure and Analytics Reporting
Since there are no dumb questions, here's mine: Our url structure currently displays the date followed by the post title. However, our news website has many categories like world, sports, entertainment etc. Now, when tracking in GA we get to see how many hits a specific page is getting (like entertainment) but since the category is not defined in the URL GA does not add the detail story views to the category page views. To illustrate further, a story from the entertainment section maybe displayed on the Home page and a reader may click on that story and read it without going to the entertainment page. This however, does not reflect in the analytics for that specific page(in this example, the entertainment page). My question is, should we ammend the url structure to include the categories, if so, would the editor have to do that while composing the post or is there some other way. We are using WP. Or should I create some filters or something on GA. Thanks!
Reporting & Analytics | | RishadShaikh590