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
-
301 Redirect chain
I've got a redirect chain happening
On-Page Optimization | | Libra_Photographic
http > https> https.www. I can't find how to fix this one. My site is on siteground which forces the https at server level and then onto cloudflare. Anyone have any ideas?0 -
No index for http version of website
Hi, I've had a message from Google search console to say the sitemap for the http version of my site is tagged as no index. As the https version is indexed, do I need to change the http version to be indexed as well? Do I need to keep the http version of the site in search console alongside the https version, or should I remove it? Advice appreciated!
On-Page Optimization | | Robingoodlad0 -
Site has 302 redirects for HTTP to HTTPS when it should be 301
Hey all, In the latest Moz crawl, certain pages on our website have shown as having 302 redirects for the http to https, but not all. There should be a 301 solution, but wanted to see if anyone had any advice or guidance. Thanks!
On-Page Optimization | | Julzseo1 -
SEO results/title tags/desktop vs. mobile
I am trying to figure out why my title tags comes up different between desktop and mobile search results. Desktop returns my title tag as written, but on mobile I get something completely different. It's related to the site, but not anything I can read, as coded in the site (i.e. not the title tags, meta, or anywhere else). Has anyone else experienced this? My title tag is 64 characters - I know it's a little bit over, but would that cause such a weird issue as a completely different title in the search results?
On-Page Optimization | | tallyhodesign0 -
Is my domain holding me back in the SERPS?
Even after a good year or so, my site intensivedrivingschoolmiltonkeynes.co.uk does not rank in the top 10 (google.co.uk) for "Intensive Driving School Milton Keynes", and is nowhere for "Driving School Milton Keynes". Do you think the domain name is being penalised, or do you think there are other factors that contribute to the poor performance.
On-Page Optimization | | Buffalo-Mobile1 -
Alt text / internal linking
Hi everyone A question about best practice when linking from pictures on our homepage - hirespace.com We have an option of using divs with background images (nicer in terms of design) but it means that we can't use anchor text or alt text to show Google what these internal links are about. The other option is to use images which do not allow us as much flexibility in terms of CSS but would allow us to use alt text. There is also an opinion that we should have separate text links at the bottom of the homepage to get the anchor page in. What is best practice in this situation - is alt text worth sacrificing some CSS flexibility for? How important is anchor/alt text for internal linking? Thanks guys.
On-Page Optimization | | HireSpace0 -
Keyword domains
Hello, I am the proprietor of RacquetSource.com, Is there any merit to using keyword domains and have them redirect to the site, or a specific page on the site? For Example, the keyword term, Squash Racquets, if I were to purchase a domain name, squash-racquets.com and have it redirect to http://www.racquetsource.com/squash-racquets-s/95.htm will this effect positively to my search ranking of the keyword term Squash Racquets? Any insight would be greatly appreciated. Cheers Geoff
On-Page Optimization | | GeoffBatterham0 -
No Index help
Hi, I have alot of notices about webpages that are apparently blocked by no index robots, I look through the code on the site and cannot see any coding for this and am confused how to fix the problem. Help anyone?
On-Page Optimization | | Vetshopgroup0