• danstelter

    (@danstelter)


    Hey everyone –

    I’m going to move my site from one domain to another. It’s a strategic rebrand. So this is a done deal and a smart move.

    However, my 301 redirects, when I do them from inside my .htaccess file at BlueHost, don’t work. They 404 instead.

    Just visit this URL to see: http://www.freelancewriterinchicago.com/test-url/ (should redirect to my portfolio)

    For now, I use a plugin,”Eggplant 301 Redirects,” to redirect URLs from WordPress. I prefer to have this done through my .htaccess file.

    I suspect code in there prevents 301s from working. However, I’m not a programming wiz, so I could be wrong on that.

    Here’s my .htaccess code…curious on your thoughts on this:

    # 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
    
    # deflector.map text file that redirects unwanted referral traffic back to the source
    
    RewriteMap deflector txt:/public_html/freelancewriterinchicago/deflector.map
    RewriteCond %{HTTP_REFERER} !=""
    RewriteCond ${deflector:%{HTTP_REFERER}} =-
    RewriteRule ^ %{HTTP_REFERER} [R,L]
    
    # End deflector map
    
    # Begin blocking irritating IPs from Google Analytics - doesn't seem to work
    
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?4webmasters\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?trafficmonetize\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?100dollars-seo\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site3.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site4.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site6.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?best-seo-offer\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?free-social-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?event-tracking\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?buttons-for-your-website\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?guardlink\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?get-free-traffic-now\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?buy-cheap-online\.info [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?badreferrers\.com [NC]
    RewriteRule (.*)	- [F]
    
    # end annoying IPs
    
    # begin 301 redirects for blog/website
    
    Redirect 301 /seo-copywriting-services/professional-small-business-blogger-service/ http://www.freelancewriterinchicago.com/professional-small-business-blogger-ghostwriter-service/
    
    Redirect 301 /seo-copywriting-services/professional-ghostwriting-service/ http://www.freelancewriterinchicago.com/business-copywriting-services/professional-ghostwriting-service/
    
    Redirect 301 /why-and-how-to-become-a-thought-leader-through-blogging/ http://www.freelancewriterinchicago.com/how-to-become-a-thought-leader-by-blogging/
    
    Redirect 301 /am-i-a-good-fit-for-you/ http://www.freelancewriterinchicago.com/are-my-b2b-copywriting-services-a-good-fit-for-you/
    
    Redirect 301 /about-freelance-copywriter-in-chicago/ http://www.freelancewriterinchicago.com/about-B2B-copywriter-Dan-Stelter/
    
    Redirect 301 /website-copywriting-service-portfolio/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/
    
    Redirect 301 /test-url/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/
    
    # Set PHP handler to application/x-httpd-phpbeta on Mon Jan 11 22:51:53 MST 2016.
    AddHandler application/x-httpd-phpbeta .php
Viewing 6 replies - 1 through 6 (of 6 total)
  • MarkRH

    (@markrh)

    Need to move those 301 redirects above the WordPress section at the top. Those rules are never reached cause the WordPress part catches all of them.

    Thread Starter danstelter

    (@danstelter)

    Okay. I did that like so, but am still not getting the redirects to work. Am I still doing something wrong?

    # begin 301 redirects for blog/website

    Redirect 301 /seo-copywriting-services/professional-small-business-blogger-service/ http://www.freelancewriterinchicago.com/professional-small-business-blogger-ghostwriter-service/

    Redirect 301 /seo-copywriting-services/professional-ghostwriting-service/ http://www.freelancewriterinchicago.com/business-copywriting-services/professional-ghostwriting-service/

    Redirect 301 /why-and-how-to-become-a-thought-leader-through-blogging/ http://www.freelancewriterinchicago.com/how-to-become-a-thought-leader-by-blogging/

    Redirect 301 /am-i-a-good-fit-for-you/ http://www.freelancewriterinchicago.com/are-my-b2b-copywriting-services-a-good-fit-for-you/

    Redirect 301 /about-freelance-copywriter-in-chicago/ http://www.freelancewriterinchicago.com/about-B2B-copywriter-Dan-Stelter/

    Redirect 301 /website-copywriting-service-portfolio/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/

    Redirect 301 /test-url/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/

    # Set PHP handler to application/x-httpd-phpbeta on Mon Jan 11 22:51:53 MST 2016.
    AddHandler application/x-httpd-phpbeta .php

    # 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

    # deflector.map text file that redirects unwanted referral traffic back to the source

    RewriteMap deflector txt:/public_html/freelancewriterinchicago/deflector.map
    RewriteCond %{HTTP_REFERER} !=””
    RewriteCond ${deflector:%{HTTP_REFERER}} =-
    RewriteRule ^ %{HTTP_REFERER} [R,L]

    # End deflector map

    # Begin blocking irritating IPs from Google Analytics – doesn’t seem to work

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?4webmasters\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?trafficmonetize\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?100dollars-seo\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site3.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site4.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?site6.free-share-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?best-seo-offer\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?free-social-buttons\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?event-tracking\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?buttons-for-your-website\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?guardlink\.org [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?get-free-traffic-now\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?buy-cheap-online\.info [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?badreferrers\.com [NC]
    RewriteRule (.*) – [F]

    # end annoying IPs

    MarkRH

    (@markrh)

    Need to enclose that stuff in backticks. Anyway.. that should work. I added Redirect 301 /test-url/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/ to my blog’s .htaccess above the WordPress section and it redirects to that post on your blog.

    Thread Starter danstelter

    (@danstelter)

    I’m sure I’m doing this wrong. Where should the backticks go?

    Like so:

    # begin 301 redirects for blog/website

    Redirect 301 /seo-copywriting-services/professional-small-business-blogger-service/ http://www.freelancewriterinchicago.com/professional-small-business-blogger-ghostwriter-service/
    
    Redirect 301 /seo-copywriting-services/professional-ghostwriting-service/ http://www.freelancewriterinchicago.com/business-copywriting-services/professional-ghostwriting-service/
    
    Redirect 301 /why-and-how-to-become-a-thought-leader-through-blogging/ http://www.freelancewriterinchicago.com/how-to-become-a-thought-leader-by-blogging/
    
    Redirect 301 /am-i-a-good-fit-for-you/ http://www.freelancewriterinchicago.com/are-my-b2b-copywriting-services-a-good-fit-for-you/
    
    Redirect 301 /about-freelance-copywriter-in-chicago/ http://www.freelancewriterinchicago.com/about-B2B-copywriter-Dan-Stelter/
    
    Redirect 301 /website-copywriting-service-portfolio/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/
    
    Redirect 301 /test-url/ http://www.freelancewriterinchicago.com/b2b-copywriting-portfolio/

    At the beginning and end of the code block there? Or how? Your help is much appreciated.

    Thread Starter danstelter

    (@danstelter)

    Thanks for your help everyone. It turned out to be a quirk with Bluehost. You have to use their redirect tool through cPanel.

    And the syntax to redirect ended up looking like this:

    RewriteCond %{HTTP_HOST} ^freelancewriterinchicago\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.freelancewriterinchicago\.com$
    RewriteRule ^test\-url\/$ “http\:\/\/www\.freelancewriterinchicago\.com\/b2b\-copywriting\-portfolio\/” [R=301,L]

    So I’d recommend getting a hold of their support team if you need to do 301 redirects at Bluehost.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘.htaccess help – 301 redirects not working’ is closed to new replies.