How do you create a 301 redirect for www.mysite..com/index.html in htaccess.
-
I understand that it is possible to create a 301 redirect for www.mysite..com/index.html to www.mysite.com. (as well as subdirectories.) How is this accomplished? My hosting company says that setting this up in htaccess will cause "Apache to geti into an infinite loop and the page won’t load." I have read on the forum that this is possible. Any help would be greatly appreaciated.
THanks. Perri
-
-
Unfortunately we have off-site links that point to directory/index.html
-
Firstly make sure you have no on-site references to index.html else you'll be distilling your link juice. Ensure all references to you home page are www.mysite.com/
For the redirect try the following:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/
RewriteRule ^index.html$ http://www.mysite.com/ [R=301,L]
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
-
How to replace the keywords of our Google Site https://www.opcfitness.com/ 's TITLE
How to replace the keywords of our Google Site https://www.opcfitness.com/ 's TITLE Our new google site https://www.opcfitness.com/ page https://www.opcfitness.com/commercial-fitness title: Gym Equipment for Sale - Buy Commercial Fitness The site name is Gym Equipment for Sale. But we need the title like this Buy Commercial Fitness - Gym Equipment for Sale How to fix it?
On-Page Optimization | | ahislop5740 -
What to do to index all my links of my website?
Ok, i have a new website, with only 14.000 page indexed by google, but the potential is big, 1-2 million pages. What i have to do, to force somehow google to index my website faster? This is my website: https://vmag.ro/
On-Page Optimization | | TeodorMarin0 -
Should I add canonical links to pages that are redirected?
Hello! I am a little confused concerning canonical links. I have several URLs that all access my page, but I redirect them all. A lot of places I am told to redirect them or use canonicals. Other places, I read that I should always use canonicals. What is the right way for me? If I should use canonicals as well as redirects, which links should I do this on? I redirect my pages like this: http to https:
On-Page Optimization | | hermanok
http://example.com -> https://example.com www to non-www:
https://www.example.com -> https://example.com Remove trailing slashes
https://example.com/ -> https://example.com Would-be 404-requests to index.php?p=$1
https://example.com/home -> https://example.com/index.php?p=home ( show as https://example.com/home ) Example:
http://www.example.com/home/ -> http://www.example.com/home/ -> https://example.com/home/ -> https://example.com/home -> https://example.com/index.php?p=home ( shows as https://example.com/home ) Thank you!0 -
Why Can't I Get Indexed?
I cannot seem to get my website indexed by Google! I submitted the sitemap using Google WMT about a month ago but only one page is being indexed. There are very few backlinks to the site, so I don't believe there are any penalties due to over-optimization that would prevent indexing. Also, my robots.txt file is properly configured and is not preventing any pages from being crawled. I've tried using the "Fetch as Google" settings in WMT with no luck. Any ideas?
On-Page Optimization | | socialfirestarter0 -
www vs no-www duplicate which should I use
site is no-www I caught this in archives. Will this by my fix? Mike Davis Online Marketing Manager at McKesson May 22, 2013 Easy fix: in your .htaccess file, use this RewriteEngine On
On-Page Optimization | | touristips
RewriteCond %{HTTP_HOST} !^domain.com
RewriteRule (.*) http://domain.com/$1 [R=301,L] Remember to replace domain.com with your domain name.
Enjoy!0 -
Best way to do a 301 redirect when the incorrect page has rank and FB likes
Due to a site structural problem with our CMS we have alot of duplicate content pages (1 page, with multiple urls). We are in the process of setting up 301 redirects to correct the problem. Meanwhile; one of the pages with the "incorrect" URL happens to be the page google favors and also has about 100 FB "likes". The question is: Are we better off keeping the "incorrect" URL for that particular page and redirect the other url to it? Both have a page rank of 3. Thanks
On-Page Optimization | | foodsleuth0 -
Quickest Way to get indexed?
We would like to index a new site on all major search engines. What is the quickest way to do so?
On-Page Optimization | | ClaytonKendall0 -
301 in place, still many 404 in GWT. Why?
We have redesigned a website. The old site used to have lots of urls, the new sites has far less. We have pointed all old urls to the new urls with 301 redirects. This happened a couple of weeks ago. But we are still getting many 404 errors in Google Webmaster Tools. What's the reason for this? Thanks in advance.
On-Page Optimization | | gerardoH0