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
-
Is it OK to 301 redirect 1000s of duplicate random URLs to homepag?
Hello, We found a critical error in our site internal link structure and the way Google indexes it. Website has 1000s of URLs that are basically 50% match to homepage. They all start the same example.com/category/random/random I can do a redirect match and 301 them to homepage. This way 1000s of bogus url are not indexed and no value given. Is it OK to redirect so many URLs to homepage? Platform is creating these URLs because of search query, where it adds all site content to one page. Currently this search page /category / has own canonical and all those duplicate content URLs have canonical to that /category /. To fix my plan is to a. Remove canonical from /category / that way all those duplicate URLs don't have it either. B. Redirect match all URLs that have /category / in them to homepage. (this is most important page where 50% of that content is and should be the main page). Is this plan ok?
On-Page Optimization | | advertisingcloud1 -
Strange google indexing behaviour
Hi all Looking for a second opinion on a strange issue with has occurred on my site. The site is a magento store and because I am using all the default merchant descriptions at the moment I have noindexed the product pages (there are 300k products, the plan is to rewrite the content as we go, starting with most popular sellers). The Gbot is blocked from the pages and all the products have header tag. We forgot to noindex the popular search terms page on the site and as a result google has indexed some search result pages - we may keep this open, not sure yet, We are seeing a very strange thing in the serps. Google has indexed the search result pages, as mentioned above, however, the description and title tag being used do not belong to that page, they belong to the product page the search result links to. If i do a search in google for the indexed pages i get the categories and lots of, what appears to be, product pages. https://www.google.co.uk/search?q=site:arropa.co.uk/store&espv=2&biw=1536&bih=772&ei=LE5xVd3qA4HlUNnggKgH&start=250&sa=N One would assume that a page listed with the title of Ladies 1 Pair Young Trasparenze Mumbai Animal Print . and the description of Come on, program a little of your crazy side! Part of the edgy, sassy Young Trasparenze Medley, these soft touch, nontransparent stockings function a crazy, (along with the price) would be an entry for that individual product. However, clicking on that product opens up a search results page (very slowly as the site is processing an update still - it is not for public use thus far) which can be seen here http://arropa.co.uk/store/catalogsearch/result/?q=+ladies+1+pair+young+trasparenze+mumbai+animal+print+tights+75+off+military+l+ yes, the search result page is for that particular item but nowhere on the page is the title, description and price, nor has it ever been. Am a little puzzled about this and what it would do re duplicate content as im using the manufacturer data at present. Ideally i would like to keep the search results pages open. Any thoughts would be most welcome. Couple of things to note. Im aware the site is too slow for general public use. It will be fully cached once running, as i say, it has 300k+ products so isn't small. Also, am aware that there are no images. They exist but we are moving the images around, hence being down. Always a fun task when there are 25gb of the things!! Many thanks Carl
On-Page Optimization | | WonkyDog0 -
One or two keywords/pages
Hi, I have a question about good keyword practice. I have a page: http://www.holdnyt.dk/skader-karantaener/fodbold/england-premier-league It lists all injuries ("skader" in danish) and suspensions ("karantaener" in danish) for the english premier league in football/soccer. On the page one can choose to show only injuries OR suspensions, which have their own URLs: http://www.holdnyt.dk/skader-karantaener/fodbold/england-premier-league/skader http://www.holdnyt.dk/skader-karantaener/fodbold/england-premier-league/karantaener My question is - what is best. To optimize the first URL (the more general one) to fit both of the following keywords:
On-Page Optimization | | rasmusbang
"skader premier league" and "karantaener premier league" OR should i focus on optimizing the two latter URLs, the more specfiic to target the two keywords. Regards, Rasmus0 -
Which redirect to use when redirecting to https page from http page
I have one form under https which is redirected from the regular http page. this site was not made by me and I am trying to understand if the way it was redirected using 302 redirect is a problem Thanks
On-Page Optimization | | ciznerguy0 -
Temp redirects of homepage URLs
Working on a site for a client and the CMS provider has all variants of their domain (.co.uk & .com and / and http:// etc) temp redirecting to the /default.aspx homepage. I know in theory that this means no Google Juice is being passed to the final location page, does this mean that all backlinks that point to their domain are not actually passing Juice onto the homepage? Thanks
On-Page Optimization | | Switch_Digital0 -
No index parts of a page?
Little bit of an odd question this, but how would one go about getting Google to not index certain content on a page? I'm developing an online store for a client and for a few of the products they will be stocking they will be using the manufacturers specs and descriptions. These descriptions and specs, therefore, will not be unique as they will be also used by a number of other websites. The title tag, onpage h1 etc will be fine for the seo of the actual pages (with backlinks, of course) so the impact of google not counting the description should be slight. I'm sure this can be done but for the life of me I cannot remember how. Thanks Carl
On-Page Optimization | | Grumpy_Carl0 -
On my site, www.myagingfolks.com, only a small number of my pages appear to be indexed by google or yahoo. Is that due to not having an XML sitemap, keywords, or some other problem?
On my site, www.myagingfolks.com, only a small number of my pages appear to be indexed by google or yahoo. I have thousands of pages! Is that due to not having an XML sitemap, keywords, or some other problem?
On-Page Optimization | | Jordanrg0 -
301 redirect and then keywords in URL
Hi, Matt Cutts says that 301 redirects, including the ones on internal pages, causes the loss of a little bit of link juice. But also, I know that keywords in the URL are very important. On our site, we've got unoptimized URLs (few keywords) in the internal pages. Is it worth doing a 301 redirect in order to optimize the URLs for each main page. 301 redirects are the only way we can do it on our premade cart For example (just an example) say our main (1 of the 4) keywords for the page is "brown shoes". I'm wondering if I should redirect something like shoes.com/shoecolors.html to shoes.com/brown-shoes.html In other words, with the loss of juice would we come out ahead? In what instances would we come out ahead?
On-Page Optimization | | BobGW0