301 redirect (www.domain.com/index to www.domain.com)
-
Hello,
Please let me know what are the exact right steps in order to get rid of the duplicate content issues related with:
www.domain.com/index.html same as www.domain.com without creating an infinite loop.
Do you have a step by step guide posted within seomoz including 301 redirect for non www to www for all urls and index.whatever to main domain name without going into a infinite loop ?
btw how to you spot the loop ? is it obvious like never ending refresh of the home page ?
thanks a lot !
-
Well, I would recommend you alter the internal links to just point to the new '/' default, but in the meantime...
I would have thought your code would have worked, but every time I try it my site falls over. It might work for you though. Give it a try but test it straight away
I'll see if I can get a different version working on my test site for you if not
-
seomoz tool is showing duplicate pages for those 3. Each of the version has at least 1 internal and even external links.
all 3 respond in the browser with the same layout/page
-
Hmm, maybe, I doubt the index.php is doing anything as if there's a index.html and index.php the .html takes precedence.
Check what's in the .php file, might be easier just to delete it.
-
Can I use a code like this ? (i've added one entry for index.php as it looks like the site has both an index.html and an index.php)
Barry Smith
Journeyman264 mozpoints
6 helpful answers
1 SEOmoz endorsed answers| Helpful Answer | Barry Smith, Head of SEO at Gaming Media Marketing | about 2 hours ago |
Probably the simplest way to redirect the non-www to the www is to put this in your .htaccess file
RewriteEngine On Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.html
RewriteRule ^(.)index.html$ http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.php
RewriteRule ^(.)index.php$ http://www.example.com/$1 [R=301,L] -
Thanks mate !
More then helpful.
-
Yeah, if it doesn't work you'll probably be faced with a blank page or you may get a 500 server error or maybe a 310. It should be obvious pretty fast
-
how it will behave if the redirect is not correct ? It will be visible ? (like a never-ending refresh of the main page)
-
I agree with Barry, but watch out for that last snippet. I've got caught when hosting companies redirect on their side. So test before walking away for more coffee : )
-
The last part redirects index.html to /
There would only be a loop if you redirected / to index.html
99.9% sure this'll work for you I'm using the exact code on a small site right now and it's working fine
-
is the last part safe ? as far as the infinite loop things that some are afraid of..
-
Probably the simplest way to redirect the non-www to the www is to put this in your .htaccess file
RewriteEngine On Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.html
RewriteRule ^(.)index.html$ http://www.example.com/$1 [R=301,L]For reference the .htaccess file goes in the root of your domain via whatever file transfer program you use and of course replace example.com with your domain
If you get stuck, let me know
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
-
Redirect Chain
Describe tu pregunta en detalle. ¡Cuanta más información proporciones, mejor! Ayuda a dar contexto a una gran respuesta. in Moz I did the analysis of my web and it tells me that I have a redirect in chain: The redirect chains often occur when several redirecting rules are accumulated, like redirecting a 'www' to a URL other than www or a page not secure to a secure page / https: Look for any recurring string that can be rewritten as a single rule. Take special care with chains 301/302 in any combination, since 302 in the mix could affect the ability of 301 to pass the value of the link. I thank you for your help in solving
On-Page Optimization | | Miguelperez0 -
Website Not Indexing
My website is not indexing due to someone's complaint in Google that was registered in 2013. The complaint says I am using copyrighted images of someone else on my website but those images were immediately removed by me. I just came to know about this complaint and lodged my problem in Lumen database. Already 14 days has passed but still my page is not indexed. Can anyone please help me?
On-Page Optimization | | varun18000 -
Multiple domains
I have a client, (for example Henry Jewelers) who likes to advertise their site as www.henry.com, but their main site resides on HenryJewelers.com. If www.henry.com has a permanent redirect to henryjewelers.com, are the two sites impacted negatively from a SEO standpoint?
On-Page Optimization | | BrettMackrell0 -
Does Widgetised Content Index The Same As A Regular Page
Hi, We have a website that was built in my opinion bizarrely where the bottom half of the page where most of the content is, is a widget. I just wondered if the content being in a widget is indexed any differently. I ask as normal pages seem to index and rank much better than the wordpress template using the widget. Hope someone might be able to clarify this. Thanks
On-Page Optimization | | denismilton0 -
Lost Page Rank after directing http:// to WWW?
Hi I am trying to redirect all the non www urls to WWW. After I redirected them, most of my category page PR are dropped to 0. Can someone please tell me if this is the normal after effect after the redirect? Example url: this is PR2 before the redirect http://www.ilovebodykits.com/category/95/Body_Kits_Front_Bumpers.html
On-Page Optimization | | ilovebodykits0 -
Description tag/ duplicate content.
Quick question - will Gg deem it duplicate content if I use the description tag text anywhere else in the on-page copy? Thanks, David
On-Page Optimization | | newstd1000 -
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
On-Page Optimization | | PerriCline0 -
Cross-domain canonical
HI, We've got a German e-commerce site on an .at domain and would like to have a copy on a .de domain as we expect higher conversions for German users there. The idea now would be to make use of the cross-domain canonical tag, create a "duplicate" on the .de domain and add a canonical tag on all sites and refer to the original content on the .at domain. That would mean the .de won't rank, but German users could see the .de domain, Austrian users the .at domain in the address bar and everybody could feel "at home" ... that's the theory. What do you guys think? Valid strategy?
On-Page Optimization | | gmellak0