Results 1 to 5 of 5

Rewrite question - domain.com -> www.domain.com

This is a discussion on Rewrite question - domain.com -> www.domain.com within the General Discussion forums, part of the vBulletin SEO Discussion category; I'd like to push any traffic coming to simply domain.com to www.domain.com . I _think_ this is the correct syntax, ...

  1. #1
    Senior Member
    Real Name
    Chris
    Join Date
    May 2007
    Location
    Boston, MA
    Posts
    116
    Liked
    0 times

    Rewrite question - domain.com -> www.domain.com

    I'd like to push any traffic coming to simply domain.com to www.domain.com. I _think_ this is the correct syntax, but I'm not sure. Any insight/corrections would be appreciated.

    Code:
    RewriteCond %{HTTP_HOST} ^domain.com
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    your code is correct.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  3. #3
    Senior Member
    Real Name
    Chris
    Join Date
    May 2007
    Location
    Boston, MA
    Posts
    116
    Liked
    0 times
    Thanks as always Oleg!

  4. #4
    Junior Member club3g's Avatar
    Real Name
    Ed Baldwin
    Join Date
    May 2007
    Location
    Orlando, FL
    Posts
    9
    Liked
    0 times
    I put the code above in a .htaccess file in my root folder.

    Club3G still works though. Any ideas?

  5. #5
    Junior Member club3g's Avatar
    Real Name
    Ed Baldwin
    Join Date
    May 2007
    Location
    Orlando, FL
    Posts
    9
    Liked
    0 times
    Code:
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^domain.com [NC] 
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    This is the whole code that needs to be used.

Similar Threads

  1. Syntax for Custom Rewrite Rules
    By Joe Ward in forum Custom Rewrite Rules
    Replies: 33
    Last Post: 02-10-2011, 09:49 PM
  2. Full vBulletin Rewrite System
    By Snake in forum Custom Rewrite Rules
    Replies: 13
    Last Post: 06-05-2007, 11:42 PM
  3. rewrite question
    By empservices in forum Pre-Sales Questions
    Replies: 2
    Last Post: 05-05-2006, 10:38 PM
  4. Redirect from www.domain.com to domain.com
    By amykhar in forum General Discussion
    Replies: 9
    Last Post: 10-17-2005, 07:39 PM

Posting Permissions

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