Results 1 to 2 of 2

Thread: No-WWW 301 Redirect

  1. #1
    Join Date
    Mar 2008
    Posts
    1

    Question No-WWW 301 Redirect

    Firstly, I am not a master web developer. I was reading about this no-www to www redirect to avoid duplicate content. I attempted to insert the code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^bmswebsite.com [NC]
    RewriteRule ^(.*)$ http://www.bmswebsite.com/$1 [L,R=301]
    into my .htaccess file. I then typed in bmswebsite.com into my IE6 browser bar and a "page not found" message appeared. Without the redirect, bmswebsite.com and www.bmswebsite.com appeared without a problem.

    Am I doing something wrong, did I not give the server time to adjust, and what exactly is this 301 redirect supposed to do.. make bmswebsite.com appear as www.bmswebsite.com, right?

    Any help would be appreciated. Thank you in advance.

  2. #2
    Join Date
    May 2004
    Location
    The Internet
    Posts
    2,138
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    Try doing it with that formatting - I'll be honest and say I'm not sure of the intricate differences but it should work.

    Note the couple of extra bits in mine - the extra explamation mark and dollar sign. I know this is to do with regular expressions but not sure what difference they make without reading a reference book. Perhaps someone else on here can shed some light on that.

Similar Threads

  1. Help witn 301 non-www redirect
    By lightguy1 in forum Web Hosting and Domain Names
    Replies: 1
    Last Post: 15 Apr 2008, 09:51 PM
  2. Same Domain 301 Redirect
    By fraserimagery in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 10 Mar 2008, 08:09 PM
  3. Redirecting my website 301 in HTML?
    By wtfmancmon in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 24 Feb 2007, 11:50 AM

Posting Permissions

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