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
-
Combining products - edit existing product page or 301 redirect to new page?
We want to combine existing products - e.g. 'hand lotion' and 'body lotion' will become 'hand & body lotion'. As such, we'll need to combine the two product pages into one. What would be the best route to take in terms of SEO to do this? My initial reaction is to create a new product page and then 301 or 302 redirect the old products to the new product page depending on if the change is permanent or temporary. Would you agree? Or am I missing something?
On-Page Optimization | | SwankyApple1 -
Best schema option for condos / condominiums?
Hey guys, I'm doing a review on some schema on some of our sites. Most of them are generic using LocalBusiness. There are a few more specific schemas I could use, but not sure what would be the most relevant. Wondering if any of you have a suggestion or ideas? https://schema.org/Residence https://schema.org/LodgingBusiness https://schema.org/ApartmentComplex or I could just stick with LocalBusiness. I'm leaning towards LodgingBusiness or ApartmentComplex.... but when I think of LodgingBusiness I think of something temporary / vacation type deal like hotels. Apartments... kind of self explanatory, a condominium isn't exactly an apartment but perhaps it is more comparable to an apartment than a hotel, motel or inn. What are you thoughts on this? Also, which "format" is better to use RDFa, microdata, or JSON-LD. Does it matter?
On-Page Optimization | | donnieath0 -
HTML Site SEO (NO CMS)
I have got a client site, which is dated (2007) and has not been shifted to any recognised CMS yet. It is HTML based. Is it possible to SEO on such a site? Is it even worth it? If it is possible to do SEO on this, any suggestions will be highly appreciated. Thank you.
On-Page Optimization | | ArthurRadtke3 -
23000 Links are not found- Should I redirect them?
Hi I have been deleting product links from my website but never redirect them. On my google webmaster, it shows there is total 23000 products are not found. Should I redirect them all back to the home page? For the pages with soft 404 response.. should I also redirect those original URL back to home page ? Thanks
On-Page Optimization | | ilovebodykits0 -
301 rediects - weird characters
Hi, Just cleaning up some 404 errors in my site in GWT and noticed a couple of external links pointing at me that are wrong. Basically they are from a couple of DIY forum sites (I've not put these links in place myself they are 100% natural) and it appears that the owners of the forums amend the links (inserting characters into link) so they are not quite right. How would I go about redirecting the following - www.example.co.uk/blueberry_pie.htm Whatever I try doesn't work and I always end up with a 404! Cheers
On-Page Optimization | | Jon-C
J0 -
Html code for none .index
In the diagnostic I have several errors in Duplicate Page Content and Title. The thing is that the errors is on the same page but with "different" names. One is called http://siteX.com/ another is called http://www.siteX.com/ and the same third one is called
On-Page Optimization | | mato
http://www.siteX.com/index.html How do I go about changing all three sites, I have changed the /index.html one but dont know how to catch the other once. Is it possible, if it is I would like to know how?0 -
301 redirect usage
I just wondering if using a lot of 301 redirects could hurt to my seo? We have site which have a lot of content with such links: title: This Is Title page url: www.site.com/This-Is-Title-page.html and we use for each page 301 redirect to remove capital letters in url: www.site.com/this-is-title-page.html Is this is good idea and not hurting to seo ? Thanks in advance
On-Page Optimization | | bele0 -
301 redirect OK for a newer version of a page that is a different url?
I have about 500 products with multiple urls for the same product, but different versions. I sell wine and have a different page for each vintage. I've decided that is not the best way to go, and want to point the older vintage pages to the latest version page, and make that the only page for the product as time goes on. Do I have to put a link in the text from each older page to the newer, or can I use a 301 to redirect them to the new page? I don't want google to think I'm pulling something funny.
On-Page Optimization | | JeanYates0