9 replies
Where in the .htaccess file (top, bottom, or center) does the piece of code go to 301 redirect a URL? For example, a non-www to a www URL?:confused:
#file #htaccess
  • Profile picture of the author Marketing Cheetah
    I think it depends what you have there. However, here is the complete tutorial: How to Redirect a Web Page Using a 301 Redirect
    {{ DiscussionBoard.errors[3381460].message }}
  • Profile picture of the author BudgetSEO
    This should help you - Steven Hargrove : How to redirect a web page, the smart way

    Not my site/aff link.
    Signature
    Let me Secure your wordpress website for the price of a small Pizza
    Weather Balloons Election Supplies
    If you need the ''cheapest'' quote, don't waste your time contacting me.
    {{ DiscussionBoard.errors[3381461].message }}
  • Profile picture of the author GeckoTribe
    It doesn't matter where you put it, as long as it's not inside a block that prevents it from doing what you want. The easiest way to ensure that is to stick it right at the top or bottom of the file.
    Signature

    Antone Roundy

    Want up to 57 bloggers to support your blog? Join a Team (free).

    Keep your blog active faster and easier with "Blog Riffing":
    * Free: PDF, High Impact Blog Riffing Course

    {{ DiscussionBoard.errors[3381509].message }}
  • Profile picture of the author Steve Powers
    You can put it anywhere you like, it wouldn't affect 301 redirect.
    Signature
    HostEase Web Hosting
    20% for shared web hosting with coupon code "hostease"! $7.95 per domain with coupon code "695TLD"!
    99.9% Uptime Guarantee! 30 Day Money Back Guarantee! 24/7/365 Customer Support!
    {{ DiscussionBoard.errors[3384480].message }}
  • Profile picture of the author Al_Warrior
    if you have your hosting with hostgator, they will do it for you, and they will send you the code they placed into the file...their customer service is great! Good luck!
    Signature

    {{ DiscussionBoard.errors[3385290].message }}
  • Profile picture of the author pc101seo
    Originally Posted by Terrence Taitt View Post

    Where in the .htaccess file (top, bottom, or center) does the piece of code go to 301 redirect a URL? For example, a non-www to a www URL?:confused:
    First thing first .HTACCES is not a file it is an extension like .exe, .doc, .xls, .ppt and etc...


    now for redirection

    HTML Code:
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
    
    Please REPLACE domain.com and www.newdomain.com with your actual domain name. 
    
    
    or
    
    Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html
    Signature
    {{ DiscussionBoard.errors[3386127].message }}

Trending Topics