Do I need to 301 redirect www.domain.com/index.html to www.domain.com/ ?
-
So, interestingly enough, the Moz crawler picked up my index.html file (homepage) and reported duplicate content, of course. But, Google hasn't seemed to index the www.domain.com/index.html version of my homepage, just the www.domain.com version. However, it looks like I do have links going specifically to www.domain.com/index.html and I want to make sure those are getting counted towards my overall domain strength.
Is it necessary to 301 redirect in the scenario described above?
-
Hi,
I tested the code mentioned above:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)index.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]It works well for index.php, but not for XX-index.php. The site where I tested this code is bilingual, so there is also a GR-index.php file and the above code redirects it to the root domain as well.
Also, another problem is that the code above causes the redirection of index.php inside any directory. For example, http://domain.com/directory/index.php is redirected to http://domain.com/directory/
How can I avoid this and keep only a "basic" redirection of http://domain.com/index.php to http://domain.com?
Yannis
-
I would recommend you to do that. Homepage may have different versions depending on the CMS you are using.
index.htm index.html
index.php
So as @donford mentioned you can fix that with .htaccess
-
Yep,
This code inside your .htaccess file should fix that.
``RewriteEngine On RewriteBase /` RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]` Hope it helps, Don
-
Yes, you will want to redirect it. Be careful though as a lot of times this isn't done correctly and creates a loop. There are multiple ways to do this including but not limited to DirectoryIndex or a RewriteRule
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
-
Mobile-First Indexing New Site monetized with Adsense AMP or not?
I am considering developing a new site monetized with Adsense. I am wondering if it's still worth bothering with AMP, it will take some work to get the functionality I have in mind working on these pages due to the inherent limitations. Has anyone got any insights in terms of current and future benefits of AMP in terms of ranking benefits and Adsense earning potential?
Web Design | | GrouchyKids0 -
How long should an old site redirecting to a new site remain activated on a server?
Once I switch a site to a new domain (with links to corresponding/relative pages), will I have to keep the old site live forever for those links to work, or how long should I wait before I inactivate the old site on our server?
Web Design | | jwanner0 -
Duplicate Content? Designing new site, but all content got indexed on developer's sandbox
An ecommerce I'm helping is getting a complete redesign. Their developer had a sandbox version of their new site for design & testing. Several thousand products were loaded into the sandbox site. Then Google/Bing crawled and indexed the site (because developer didn't have a robots.txt), picking up and caching about 7,200 pages. There were even 2-3 orders placed on the sandbox site, so people were finding it. So what happens now?
Web Design | | trafficmotion
When the sandbox site is transferred to the final version on the proper domain, is there a duplicate content issue?
How can the developer fix this?0 -
Is it bad to have /index.php at the end of a uri?
Is it bad for SEO if traffic is directed to "http://www.example.com/someuri/index.php" instead of "http://www.example.com/someuri/" and would it be works setting up a redirect rule at htaccess level?
Web Design | | NoisyLittleMonkey1 -
301 Redirect ! Joomla Pages, Already ranking. ( just wanted to change the url
hey guys hope everyone had a new year. I am ranking for a page on my site that i want to ( not specifically move ), but just change the url name: It is too long i think and i want to move it from one portion of my architecture to another menu. I have never physically done a 301 redirect myself, always had someone do it for me. I wanted some pointers. Since it is a fairly new site 4 months old! What are my options. Do i need to 301 redirect the page, if i am changing the Structure and AI of my site, or can i just change the url as is and it will still get ranked? How do i keep that url put delete the page and redirect it ? Sorry its very simple but i wanted to get the communities help to continue on ! Best Wishes HAmpig
Web Design | | BizDetox0 -
RSS Submissions Positive/Negative/Neutral Impact...
We are looking to push our site content and blog content out to the masses... There are several sites and services that accept RSS feeds or submit RSS feeds to 50+ RSS sites. Have you seen an positive or negative impact of submitting feeds to these RSS directories? I am primarily looking at this for getting or content out and builing inbound links... Any thoughts or feedback would be appreciated... C
Web Design | | hireawizseo0 -
Display a message after 301 redirect.
I know this one is a little more technical than pure SEO, but it somewhat ties in. I'm redirecting 2 sites to one. The companies have combined, and I've imported all their content that has been created, and the url mapping is set up correctly. So it currently is set up like this: A.com --> C.com
Web Design | | WilliamBay
A.com/blogpost-1 --> C.com/blogpost-1 B.com --> C.com B.com/blogpost-20 --> C.com/blogpost-20 What i would like is some method a redirect when landing at C.com or C.com/blogpost-XX. And in turn display a message in a DIV so I can style it. And yes, I have nothing better to do on a Friday night 🙂0 -
Parked Domain or Redirect
Should I park a domain or Redirect? And what is the best way? I need to switch our domain name. I currently have all of our domains redirecting to our main website. I have set up there own hosting in our cpanel account so I could redirect them to our main domain. Was this too many steps? I tried putting all of our domains in our main domains, .htaccess file, and redirected them to our main website, but they did not work. So that is why I set up there own cpanel accounts. Now they work fine. However, my hosting company told me that I could just park the domain on our current domains account. If I can redirect all of these domain in one place, that would be great. I thought that a parked domain is considered duplicate websites, as both urls work, displaying the entire website with both urls. So Would I have to re upload our entire website to the account that I want as our main domain? Or is there another way of going about doing this?
Web Design | | hfranz0