Submit Your Article Forum Rules

Results 1 to 5 of 5

Thread: 301 redirect issue - Need help with .htaccess file

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    12

    301 redirect issue - Need help with .htaccess file

    Hi,

    About 3 months ago I launched a new website and set up 301 redirects to redirect old pages to appropriate pages on the new site. All of my old pages are redirecting just fine, but am having issues with redirecting old home page(s) to new homepage.

    Old site: site: www.bellevuechiropractor.com

    No matter what I do, the old site redirects to the wrong version of my new homepage.

    eastsidechiro.net
    eastsidechiro.net/index.html
    www.eastsidechiro.net
    www.eastsidechiro.net/index.html

    All redirect to www.bellevuechiropractor.com/index.html as opposed to www.bellevuechiropractor.com

    The old site has 7-8 years of history, links, citations, etc., and I would really prefer to have that page rank flow to the proper .com version of the new site. Any help with my .htaccess file would be greatly appreciated as I can't figure out what the issue is.

    Thanks in advance for your help!!!! .htaccess file from the old site below:
    Code:
     AddType x-mapp-php5 .php .html .htm
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    # Forces a trailing slash to be added
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule (.*)$ /$1/ [R=301,L]
    RewriteCond %{HTTP_HOST} ^eastsidechiro.net [NC]
    RewriteRule ^(.*)$ http://www.bellevuechiropractor.com/ [L,R=301]
    RewriteCond %{HTTP_HOST} ^http://www.eastsidechiro.net [NC]
    RewriteRule ^(.*)$ http://www.bellevuechiropractor.com/ [L,R=301]
    RewriteCond %{HTTP_HOST} !^www\.eastsidechiro\.net [NC]
    RewriteRule ^(.*)$ http://www.bellevuechiropractor.com/$1 [L,R=301]
    Redirect 301 /index.html http://www.bellevuechiropractor.com/
    Redirect 301 /about.html http://www.bellevuechiropractor.com/about.html
    Redirect 301 /fluoroscopy.html http://www.bellevuechiropractor.com/motion-xray.html
    Redirect 301 /treatment.html http://www.bellevuechiropractor.com/schedule-appointment.html
    Redirect 301 /testimonials.html http://www.bellevuechiropractor.com/testimonials.html
    Redirect 301 /contact.html http://www.bellevuechiropractor.com/contact.html
    Redirect 301 /faq.html http://www.bellevuechiropractor.com/chiropractic-treatment.html
    Redirect 301 /Headaches.html http://www.bellevuechiropractor.com/headaches.html
    Last edited by HTMLBasicTutor; 10-22-2011 at 04:29 PM.

  2. #2
    Moderator Tiggerito's Avatar
    Join Date
    May 2004
    Location
    Adelaide, Australia
    Posts
    550
    They all work fine for me?

    You do have some syntax errors, but nothing that looks dangerous.

    For completeness you should end conditions with a $ to indicate a complete match. So this...

    HTML Code:
    RewriteCond %{HTTP_HOST} ^eastsidechiro.net [NC]
    Shoud be this

    HTML Code:
    RewriteCond %{HTTP_HOST} ^eastsidechiro\.net$ [NC]
    You will see I made another change. When doing RewriteConds a dot means any character. You should replace it with backslash-dot to specifically restrict the match to a dot. The following condition you used had it right.

    HTML Code:
    RewriteCond %{HTTP_HOST} !^www\.eastsidechiro\.net [NC]
    RewriteRule ^(.*)$ http://www.bellevuechiropractor.com/$1 [L,R=301]
    However, the above rule has an exclamation mark to start the rule (and is missing the final $). I've never used that option but it technically means a negate. i.e. Anything that does not match this. As the previous rule to it has the same condition without the negate, this condition is saying, for any other domain. It's rule says pass on the same path by using the $1 in the destination.

    Lets have a look at what's happening at the moment:

    HTML Code:
    http://www.eastsidechiro.net/ -> http://www.bellevuechiropractor.com/
    http://www.eastsidechiro.net/index.html -> http:// www.bellevuechiropractor.com/
    http://www.eastsidechiro.net/fluoroscopy.html -> http://www.bellevuechiropractor.com/motion-xray.html
    http://www.eastsidechiro.net/fish/   ->   404 error with no redirect *****
    http://eastsidechiro.net/ -> http://www.bellevuechiropractor.com/
    http://eastsidechiro.net/index.html -> http://www.bellevuechiropractor.com/
    http://eastsidechiro.net/fluoroscopy.html -> http://www.bellevuechiropractor.com/ *****
    http://eastsidechiro.net/fish/ -> http://www.bellevuechiropractor.com/
    I've starred the ones I think are wrong. I'm note sure why it's currently happening like this. Have you made changes?

    I'd actually re-thing how to do this.

    It seems you have several pages from the old domain that have now moved on the new domain. Deal with them first, they fix the domain for you anyhow. So put your Redirect 301s first in the list. Then do the domain switching rules. For those I would pass on paths and query strings so you can still track when people refer to bad urls. You can then add more Redirect 301s to deal with those issues. I think a template for your domain redirect should look like this:

    HTML Code:
    RewriteCond %{HTTP_HOST} ^www\.eastsidechiro\.net$ [NC]
    RewriteRule ^(.*)$ http://www.bellevuechiropractor.com/$1 [R=301,NE,NC,L]
    This basically says, just change the domain name and leave the rest as is. The path is left in tact because of the $1 and any query string parameters are passed on by default. Your index.html issues should be dealt with by some Redirect 301s you place before these.
    Last edited by deepsand; 10-22-2011 at 04:29 PM. Reason: merged traffic flow
    by Tony McCreath (Tiggerito)
    owner of Web Site Advantage

  3. The following user agrees with Tiggerito:
  4. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    12
    Argh, this is where I wish I did this for a living. I've read your reply a number of times and am having trouble with the sequence of what needs to happen.

    First, put the redirect 301s in the list first... meaning redirecting all of the old sub-pages to the new sub-pages (/about, etc.)

    The template for the domain redirect that you have above (last quote box), should that be repeated for all 4 verions of the old homepage?? ie. www vs. non-www, and .com vs .com/index.html, each with their own cond/rule redirecting to the proper new .com homepage?

    Thanks for your help mccreath

  5. #4
    WebProWorld MVP deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,459


    Ran Header checks on all appropriate top nodes, including www.bellevuechiropractor.com/index.html, and all do a single 301 hop to www.bellevuechiropractor.com/.

    Did you make a recent change? Or, are you referring to certain internal pages that are misdirected?

  6. #5
    Moderator Tiggerito's Avatar
    Join Date
    May 2004
    Location
    Adelaide, Australia
    Posts
    550
    Quote Originally Posted by taterchips View Post
    Argh, this is where I wish I did this for a living. I've read your reply a number of times and am having trouble with the sequence of what needs to happen.

    First, put the redirect 301s in the list first... meaning redirecting all of the old sub-pages to the new sub-pages (/about, etc.)

    The template for the domain redirect that you have above (last quote box), should that be repeated for all 4 verions of the old homepage?? ie. www vs. non-www, and .com vs .com/index.html, each with their own cond/rule redirecting to the proper new .com homepage?

    Thanks for your help mccreath
    You got it. As deepsand said, have you made changes as what I saw did not quite fit what you stated was not working.
    by Tony McCreath (Tiggerito)
    owner of Web Site Advantage

Posting Permissions

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