SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    301 Redirect Just Not Working :-(

    Good Morning from 14 degrees C Wetherby UK :-)

    On this site www.davidclick.com I ran a canonical error test (screaming frog) to learn I had indeed to versions of my Home page i.e.
    www.davidclick.com & www.davidclick.com/index.htm

    Having learnt this i then jumped into my ht acccess file & added this line of code:
    301 /index.htm http:www.davidclick.com
    But that didnt work in that an error warning -
    "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

    So my question is please... "How do i fix the canonical error two versio0ns of my home page is generating"

    Footnote: I have noticed also each there is a <link rel="canonical" href="http://www.davidclick.com"/> on the home page & wonder if this could be cocking things up.

    Any insights welcome :-)
    Last edited by Stevie D; Aug 28, 2012 at 12:01. Reason: URLs delinked
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,169
    Mentioned
    153 Post(s)
    Tagged
    0 Thread(s)
    Take a look again at your command.
    301 /index.htm http:www.davidclick.com

    First, I believe it should have the word Redirect in front of the 301, second, you are missing the slashes after the http:
    Redirect 301 /index.htm http://www.davidclick.com

  3. #3
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Zygoma View Post
    On this site www.davidclick.com I ran a canonical error test (screaming frog) to learn I had indeed to versions of my Home page i.e.
    www.davidclick.com & www.davidclick.com/index.htm

    Having learnt this i then jumped into my ht acccess file & added this line of code:
    301 /index.htm http:www.davidclick.com
    But that didnt work in that an error warning -
    "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

    So my question is please... "How do i fix the canonical error two versio0ns of my home page is generating"

    Footnote: I have noticed also each there is a <link rel="canonical" href="http://www.davidclick.com"/> on the home page & wonder if this could be cocking things up.
    As cpradio says, you're missing a // from your 301 line, but assuming that's just bad copying ... I'm not entirely sure what the problem is. Your canonical link is exactly what I would expect to see, telling search engines that whatever route they have arrived at the page by you want them to index it as www.davidclick.com. I wouldn't worry about any other redirects.

    The problem with trying to use a redirect to get rid of the 'index.htm' is that you end up in an infinite loop. When you ask for www.davidclick.com (or any other URL that doesn't end with a filename), the server needs to give a page and so automatically appends 'index.htm' (or whatever you have selected as your default filename) onto the end, and asks for www.davidclick.com/index.htm. The server then thinks "Hmmm, I have to redirect that URL to www.davidclick.com" and then it all goes round again.

  4. #4
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Big thank you for you replies, Ive knocked off the the ht access redirect bit :-)
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,656
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Aw, if the www and non-www'd domains are co-located (as they usually are), then the correct code above (cprado) will generate an endless loop. That's where the power of mod_rewrite comes in: Check whether www or non-www and redirect the non-www to the www'd URL, i.e.,
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^davidclick\.com$ [NC]
    RewriteRule .? http://www.davidclick.com%{REQUEST_URI} [R=301,L]
    All this is in the tutorial linked in my signature so I'd recommend reading to know why this is the code (see Sample Code - force www) to use.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •