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
-
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 -
Indexing Issues
One of the main pages on my site, http://www.waikoloavacationrentals.com/kolea-rentals/condos, I have been having a hard time getting google to index it correctly or at all. It is one of the top pages on my site and should be in my sub links in google, but it is not even showing up in searches. Any input would be appreciated. The only red flap issue is the number of outgoing links, but that is the way the page is supposed to be. I would assume most real estate listing pages are very similar. Ultimately when you look at traffic, time on page, inbound links, etc. it is one of the top pages on my site in all those categories. Any input would be greatly appreciated.
On-Page Optimization | | RobDalton0 -
SERP Hijacking/Content Theft/ 302 Redirect?
Sorry for the second post, thought this should have it's own. Here is the problem I am facing amongst many others. Let's take the search term "Air Jordan Release Dates 2017" and place it into Google Search. Here is a link:
On-Page Optimization | | SneakerFiles
https://www.google.com/#q=air+jordan+release+dates+2017 Towards the bottom of the page, you will see a website that has SneakerFiles (my website) in the title. The exact title is: Air Jordan Release Dates 2016, 2017 | SneakerFiles - Osce Now, this is my content, but not my website. For some reason, Google thinks this is my site. If you click on the link in search, it automatically redirects you to another page (maybe 302 redirect), but in the cache you can see it's mine:
http://webcache.googleusercontent.com/search?q=cache:qrVEUDE1t48J:www.osce.gob.pe/take_p_firm.asp%3F+&cd=8&hl=en&ct=clnk&gl=us I have blocked the websites IP, disallowed my style.css to be used so it just shows a links without the style, still nothing. I have submitted multiple google spam reports as well as feedback from search. At times, my page will return to the search but it gets replaced by this website. I even filed a DMCA with Google, they declined it. I reached out to their Host and Domain register multiple times, never got a response. The sad part about this, it's happening for other keywords, for example if you search "KD 9 Colorways", the first result is for my website but on another domain name (my website does rank 3rd for a different Tag page). The page I worked hard on keeping up to date. I did notice this bit of javascript from the cloaked/hacked/serp hijacking website: I disabled iFrames...(think this helps) so not sure how they are doing this. Any help would be greatly appreciated. Note: I am using Wordpress if that means anything.0 -
Does this index well
hi i have been looking at this template but as the content will be generated from their database will it index well - am i better to build a static equivalent using something like visual composer as i am not that technical: http://realhomes.inspirythemes.biz/listing/
On-Page Optimization | | neilhenderson0 -
Why are my pages de-indexed?
<form id="form-t3_37nfib9dz" class="usertext" action="http://www.reddit.com/r/SEO/comments/37nfib/why_were_my_pages_deindexed/#"> Hello all, I am very new to SEO. For some reason many of the pages on my site were de-indexed. Specifically the ones linked from this page: However other pages, like the ones linked from this page and this page were not de-indexed. http://www.lawyerconnection.ca/practice-areas/car-accident-injury-lawyers/[1] However the pages linked from this page were not de-indexed: http://www.lawyerconnection.ca/practice-areas/slip-and-fall-lawyers/[2] http://www.lawyerconnection.ca/podcastresources/[3] That first page itself was not de-indexed, just the site that it links to. It just happened today, so maybe I am jumping the gun but I doubt it. When I enter the page into google webmaster tools again and press fetch, one of the child pages, it re-indexes. What could be the problem here? I had someone re-write the content for every city but I have a feeling that there is less differences in the car accidents pages? Is this considered duplicated content do you think? Am I making some other mistake I can't think of? Is it just a one day blip (I doubt it) Let me know, thanks. </form>
On-Page Optimization | | RafeTLouis0 -
302 redirections warnings
Hi there, the SEOMOZ crawler has detected some warinings related to the 302 temporary redirections. Example: http://www.tarifakitesurfcamp.com/tks-camp/alojamiento/ redirects to www.tarifakeitesurfcamp.com/error-404 I have made some 301 redirections, located at the end of the final (inicially) and later I just moved them to the top of the file. The htaccess file content is: redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/escuela/ http://www.tarifakitesurfcamp.com/gisela-pulido-escuela/
On-Page Optimization | | juanmiguelcr
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/cursos-kite/ http://www.tarifakitesurfcamp.com/gisela-pulido/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/curso-idiomas/ http://www.tarifakitesurfcamp.com/campamento-bilingue-para-ninos/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/programa-de-actividades/ http://www.tarifakitesurfcamp.com/kitesurf-para-ninos/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/alojamiento/ http://www.tarifakitesurfcamp.com/campamento-de-kitesurf/
redirect 301 http://www.tarifakitesurfcamp.com/tks-camp/la-empresa-2/ http://www.tarifakitesurfcamp.com/kitesurf-para-ninos-tarifa/ BEGIN ASIGNACIÓN DE TIEMPO DE CACHÉ A IMÁGNES, ARCHIVOS JSS, CSS <ifmodule mod_expires.c="">#activa la generacion de cabecera Expires
ExpiresActive On
#establece el tiempo de cache por defecto
ExpiresDefault A604800
<filesmatch ".(jpg|gif|png|css|ico|js)$"="">#suma 1 dia a la hora de acceso del usuario ExpiresDefault "access plus 7 day"</filesmatch></ifmodule> END ASIGNACIÓN DE TIEMPO DE CACHÉ A IMÁGNES, ARCHIVOS JSS, CSS BEGIN W3TC Browser Cache <ifmodule mod_deflate.c=""><ifmodule mod_headers.c="">Header append Vary User-Agent env=!dont-vary</ifmodule>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<ifmodule mod_mime.c=""># DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml</ifmodule></ifmodule> END W3TC Browser Cache BEGIN W3TC Page Cache core <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} /$
RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" [L]</ifmodule> END W3TC Page Cache core BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress What's wrong? What could happen is I maintain these 302 redirections? Thanks!0 -
Google Index Report
Hi, I have just checked my google webmaster tools account and viewed the index status of my website and it produced the attached graph, which show quite a big spike in indexing during July and August 2012. Does this look normal or does it reveal anything peculiar? We did have a new website launched in June 2012 and I re-submitted the sites URL's to google as part of the re-launch and so I am unsure if this may account for the spike. Any advice appreciated. Thanks indexing.png
On-Page Optimization | | UnderMe0 -
Quick Question on Redirects
This might be a silly question, but one important enough for me to ensure that I understand the best practice of URL redirects... I'm thinking of changing my URL's and hierachy of some of my WP subpages around, in order to logically fit the keyword into the url and place the subpage closer to the root domain. My question is, when doing this, can I simply edit the URL and create a redirect after the fact, essentially killing the old URL. Or, do I create the new page with the updated URL and hierarchy, keeping the old page live and intact, but have that 301 redirect to its new corresponding destination? Thanks
On-Page Optimization | | JayAdams320