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
-
Does intercom support pages and redirect issue can affect the SEO performance of our website?
I noticed that in the redirect issues I have, most of the issues are coming from our Intercom support links. I want to ask, does intercom support pages and redirect issue can affect the SEO performance of our website?
Reporting & Analytics | | Envoke-Marketing0 -
Tracking a Redirect
Recently a client of mine had a new site developed and had changed their domain, so the old URL is now redirecting to the new URL. They want to be able to track referral traffic in the analytics so we can decipher how much direct traffic is coming in from people typing in the old URL. Is this possible and if so, can I have a guide in doing so? Thanks!
Reporting & Analytics | | DigMS0 -
Weird URL Structure in GA
Hey everyone, Thanks in advance for any insight on this. I've been researching it quite a bit on Google and haven't found anything yet. In Analytics, under our pages report, we're getting a lot of pages that look like this: www.execucar.com/https://www.execucar.com or www.execucar.com/https://www.execucar.com/locations/orlando-car-service Any thoughts on how to fix this? These pages don't exist...I'm at such a loss.
Reporting & Analytics | | SuperShuttle0 -
Campaign Tracking URLs and the Impact on SEO
Hi Guys, I am setting up tracking for a couple of offline campaigns in Analytics and would just like to know if this will cause issues. The situation is below: Two URLs Ranking Well Organically: www.domain.co.uk/area-covered/area-a www.domain.co.uk/area-covered/area-b URLs Setup for the Purpose of Offline Campaigns www.domain.co.uk/campaign1 www.domain.co.uk/campaign2 Plan to Track this in Analytics www.domain.co.uk/campaign1 redirecting to www.domain.co.uk/area-covered/area-a_&utm_medium=qr&utm_source=test1&utm_campaign=test1_ www.domain.co.uk/campaign2 redirecting to www.domain.co.uk/area-covered/area-a&utm_medium=qr&utm_source=test2&utm_campaign=test1__ So the idea is that the user gets a nice simple URL to input from the off-line media (www.domain.co.uk/campaign1). This then redirects to one of the pages thats performing well organically (www.domain.co.uk/area-covered/area-a) but with the relevant tracking (www.domain.co.uk/campaign1 redirecting to www.domain.co.uk/area-covered/area-a&utm_medium=qr&utm_source=test1&utm_campaign=test1). The only way that the tracking URL can be accessed by the user is if the off-line media URL is entered. My main concern here is how Google will treat this. Obviously I don't want to cause issues with the two URLs that are ranking well organically. Would having a version of exactly the same URL, just with tracking do so? Any help is appreciated! Thanks in advance.
Reporting & Analytics | | CarlWint0 -
Automatic Checking indexation of websites
Hi Guys, do you know a tool that can check al list of websites (directorys) wich automatically checks if the website are indexed in Google. The list is very long and I would like to have a tool wich checks them all with only CnP them once. thankx a lot der.rabauke
Reporting & Analytics | | Lincus0 -
Why do I have few different index URL addresses?
Yes I know, sorry guys but I also have a problem with duplicate pages. It shows that almost every page of my site has a duplicate content issue and looking at my folders in the server, I don't see all these pages... This is a static Website with no shopping cart or anything fancy. The first on the list is my [index] page and this is giving me a hint about some sort of bad settings on my end with the SEOMOZ crawler??? Please advice and thank you! index-variations.jpg
Reporting & Analytics | | cssyes0 -
Correlation between google and yahoo indexed pages
My blog ocpatentlawyer.com has about 130 pages or so. Google has indexed most if not all of the posts and pages. In contrast, yahoo has only indexed about 1/4 of the pages and posts. Are there any actions that can be taken based on this information? For example, if i prepare a blog post should I prepare it so that it will most likely be indexed into yahoo knowing that google will also index it. If so, how can i prepare blog posts that will most likely be indexed into yahoo's index?
Reporting & Analytics | | jamesjd70 -
Google: show all images indexed on a domain
Is there a way to display all images that google has indexed on a domain / subdomain? I'm basically looking for something like a site:-command for google image search.
Reporting & Analytics | | jmueller0