Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Make domain.com point to www.domain.com

  1. #1
    Join Date
    Feb 2006
    Location
    Somewhere where I don't know where I am
    Posts
    2,154

    Default How To make domain.com point to www.domain.com

    Open or create a .htaccess file in the /public_html/ directory (if the domain is an add-on domain, then the .htaccess file will be located in add-on domain's directory)

    Put this at the top of the .htaccess file (replacing 'domain' with yours)

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{HTTP_HOST} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
    Last edited by areidmtm; 01-16-2008 at 04:05 PM.
    Sign Up Now!
    Unlimited Storage, Unlimited Transfer, Host Unlimited domain names, 1 Free Domain Name
    BlueHost Features | BlueHost Help Desk | Become a BlueHost Affiliate | BlueHost CEO Blog
    (888) 401-4678 | Create a support ticket

  2. #2
    Join Date
    Feb 2006
    Location
    Florida, USA
    Posts
    1,498

    Default

    And of course the opposite..
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [nc]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

  3. #3
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    21

    Default

    For me it doesnt work. I get a page that says that "This site was moved to this location" and the word "this" is a link to "domain.com" and get an infinite loop.

    [EDIT]

    Forget. It was a conflict between the wordpress config and .htaccess settings. Changed it in Wordpress Admin Panel and everything is ok.
    Last edited by Diogenes; 01-30-2008 at 05:10 PM.

  4. #4
    Join Date
    Feb 2008
    Posts
    3

    Default

    Another newbie here.

    I've tried to insert your text into a new .htaccess but changing the suffix from ".com" to ".co.uk" however it seems to be redirecting to the ".com".

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{HTTP_HOST} ^mydomain.co.uk [nc]
    rewriterule ^(.*)$ http://www.mydomain.co.uk/$1 [r=301,nc]


    Is there something else I've missed?

  5. #5
    Join Date
    Feb 2006
    Location
    Florida, USA
    Posts
    1,498

    Default

    Only if something else is redirecting it.

  6. #6
    Join Date
    Jan 2008
    Location
    Sialkot
    Posts
    7

    Default

    Not working for me, site is not opening check www.smsdad.com or check without www site is not opening.("Add-on domain" .htaccess file created in add-on domain directory)

  7. #7
    Join Date
    Feb 2006
    Location
    Florida, USA
    Posts
    1,498

    Default

    What's in your htaccess file..

  8. #8

    Default

    Quote Originally Posted by andyv View Post
    Another newbie here.

    I've tried to insert your text into a new .htaccess but changing the suffix from ".com" to ".co.uk" however it seems to be redirecting to the ".com".

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{HTTP_HOST} ^mydomain.co.uk [nc]
    rewriterule ^(.*)$ http://www.mydomain.co.uk/$1 [r=301,nc]


    Is there something else I've missed?
    You need to place a \ backslash before the periods on the rewritecond. The following is an example of what is working for my site
    rewritecond %{HTTP_HOST} ^example\.org [nc]
    rewriterule ^(.*)$ http://www.example.org/$1 [r=301,nc]

    Try this for your site
    rewritecond %{HTTP_HOST} ^mydomain\.co\.uk [nc]

    The Apache writeup
    http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

  9. #9
    Join Date
    Jan 2008
    Location
    Sialkot
    Posts
    7

    Unhappy

    Quote Originally Posted by Basil View Post
    What's in your htaccess file..
    this is:(

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{HTTP_HOST} ^smsdad.com [nc]
    rewriterule ^(.*)$ http://www.smsdad.com/$1 [r=301,nc]

  10. #10
    Join Date
    Jan 2008
    Location
    Sialkot
    Posts
    7

    Unhappy

    Quote Originally Posted by arnb View Post
    You need to place a \ backslash before the periods on the rewritecond. The following is an example of what is working for my site
    rewritecond %{HTTP_HOST} ^example\.org [nc]
    rewriterule ^(.*)$ http://www.example.org/$1 [r=301,nc]

    Try this for your site
    rewritecond %{HTTP_HOST} ^mydomain\.co\.uk [nc]

    The Apache writeup
    http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
    Still not loading my site.:confused: :( oh God wts problem there

Posting Permissions

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