PDA

View Full Version : Make domain.com point to www.domain.com



areidmtm
01-16-2008, 01:47 PM
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)



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

Basil
01-16-2008, 03:01 PM
And of course the opposite..

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

Diogenes
01-30-2008, 03:07 PM
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.

andyv
02-09-2008, 08:53 AM
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?

Basil
02-09-2008, 08:59 AM
Only if something else is redirecting it.

djhassoo
02-20-2008, 01:42 AM
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)

Basil
02-20-2008, 01:58 AM
What's in your htaccess file..

arnb
02-20-2008, 02:36 AM
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

djhassoo
02-20-2008, 04:57 AM
What's in your htaccess file..

this is:(


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

djhassoo
02-20-2008, 05:02 AM
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

djhassoo
02-20-2008, 05:15 AM
There is wordpress blog, now i dont know what to do, how i can solve that problem

Basil
02-20-2008, 05:17 AM
Whatever you have as your index is redirecting to the non-www version. It's creating an infinite loop.

For example if you're running oh say wordpress, you have the url without the www prefix under options->general->wordress/blog address.

Add the www to the addresses.

djhassoo
02-20-2008, 05:27 AM
Thanks ALLAH problem solved, thx Basil :)

andyv
02-21-2008, 07:57 AM
arnb

Thank you.

I've actually sorted it but had to use bluehost support. I was told that they had to do the work themselves because it couldn't be done using htaccess. I wasn't given full rhyme and reason why not but I suspect that this may be because it was for the main domain and not an addon.

I'm now in the process of transferring another domain as an addon. I'll use the syntax you've provided in the first instance and see what happens.

Chickdey
03-24-2008, 10:19 AM
Ok so I have two domains (www.leonardschoolofmusic.com and www.choosejazz.com). Both of these domains are registered through Godaddy and I have them set up now with this amazing hosting place (duh...bluehost) I want people to be able to go to either domain and it take them to leonardschoolofmusic.com...I think I set it up right, because when I type in choosejazz.com it takes me to my primary domain (leonardschoolofmusic.com). However, if I put in www.choosejazz.com it takes me to a godaddy page....does anyone know what this noob should do?

thx

felgall
03-24-2008, 11:14 AM
Set the second domain up as a parked domain on BlueHost and make sure the nameservers at GoDaddy point to ns1.bluehost.com and ns2.bluehost.com

Basil
03-24-2008, 04:06 PM
Chickdey, this is usually from your ISP caching the nameservers of the www subdomain for your website because you hit it before the update was done propagating. You just need to wait for the cache to update.

greeksick.com
04-04-2008, 08:03 AM
hi... i tried the above but with no success...
this is my .htaccess


Options +FollowSymlinks

RewriteEngine on

rewritecond %{HTTP_HOST} ^greeksick\.com [nc]

rewriterule ^(.*)$ http://www.greeksick.com/$1 [r=301,nc]


ps: the wordpress thing i did't undetstand:rolleyes: :rolleyes:

redsox9
04-04-2008, 08:31 AM
Remove the backslash in your third line of code.

greeksick.com
04-04-2008, 12:28 PM
already tried...:( :(

greeksick.com
04-05-2008, 03:29 AM
i also tried this one

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] but still nothing.... why??? whyyyyyyyyyyyyy???:o :o :o

redsox9
04-05-2008, 05:31 AM
Do you have your .htaccess file in your root web directory, i.e., public_html?

greeksick.com
04-05-2008, 05:38 AM
yes
http://img90.imageshack.us/img90/6742/69495668fo3.th.jpg (http://img90.imageshack.us/my.php?image=69495668fo3.jpg)

jdozer
04-06-2008, 01:42 PM
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)



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


I'm sorry, and I know this has been asked before. I registered with godaddy, but then purchased the webhosting from BlueHost. How can I pull my domain from godaddy to bluehost?? YES, serious noob.

felgall
04-06-2008, 02:00 PM
I'm sorry, and I know this has been asked before. I registered with godaddy, but then purchased the webhosting from BlueHost. How can I pull my domain from godaddy to bluehost?? YES, serious noob.

You edit the nameservers to change them to point to ns1.bluehost.com and ns2.bluehost.com

djohns
04-07-2008, 02:01 PM
Specific cPanel Subdomains & NetObjects Fusion Settings...

My goal was to set up a second domain under my main BlueHost account, i.e. I wanted to have separate websites for and which would have the following URLs:


www.maindomain.org
www.subdomain.org

The steps needed turned out to be not very difficult but their order was critical. The primary domain is maindomain.org which has an associated cPanel login.


Step 1


Register www.subdomain.org.

Step 2


Next, add subdomain.org using cPanel. After logging into cPanel, go to “Domains” section and choose “Addon Domains”.

Select subdomain.org which should already be associated with the account.

Choose “Addon Domain” rather than “Parked”.

Create a new directory under the public_html box named “subdomain” (without quotes). i.e. html folders will be housed in public_html/subdomain/.

Set the subdomain to be subdomain.maindomain.org

Step 3


Go back to cPanel, now under Domains click on “Subdomains”.

If not created for you, create subdomain.maindomain.org and leave the document root blank, this should automatically set the document root to public_html/subdomain. You don’t need to redirect anything.

Step 4


Go back to cPanel, now under “Files” choose “FTP Accounts”.

Under “Add FTP Account” setup a login and password.
Set directory to “subdomain” (without quotes). Click the “Create” button. You should now have an FTP user account of type “Sub Account” associated with directory [home]/public_html/subdomain

Step 5


Now open up NetObjects and go to the file tranfer settings (“Settings”) under the “Publish” view.

In the “Publish Settings” box, put in

Server type: FTP

Server: maindomain.org

Directory: (leave blank)

Username & password are as set up under the cPanel FTP account for subdomain.org (Step 4 above).

That should be it. Once you publish you should be able to display the subdomain home webpage using www.subdomain.org, and the main domain homepage using www.maindomain.org.

queensgambit
04-25-2008, 08:34 AM
There's a good tutorial here. I used it for all my clients domains.

http://aruljohn.com/info/htaccess/

jenny4
07-22-2008, 11:20 AM
wondering do we need to make domain.com point to www.domain.com or it will happen automatically since domain name for both is same

arnb
07-22-2008, 11:27 AM
If you use https you probably need to redirect to the www.example.com used on the certificate

If you use cookies my experience is to redirect to one or the other.

No https or cookies it does not matter as far as I know

felgall
07-22-2008, 12:10 PM
While they both display the same page the two addresses mean that search engines treat them as different pages. Google allow you to tell them which address to use. If everyone links to the same address you are fine. The problem comes where you split incoming links between the two addresses and therefore rank lower in other search engines because each copy of the page only has half the links in.

Eriksrocks
08-25-2008, 02:18 PM
There's a good tutorial here. I used it for all my clients domains.

http://aruljohn.com/info/htaccess/

Another good tutorial on htaccess redirecting that I use:
http://www.webweaver.nu/html-tips/web-redirection.shtml