Jump to content
  • Advertisement
Sign in to follow this  
alnite

[web] regarding domain names and www

This topic is 4429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just registered a domain, and I have a little question regarding the domain name and www host name. Using gamedev.net as an example, when you type in gamedev.net, the address bar automatically converts it to www.gamedev.net, however this is not the case with my domain. I typed in my domain and it stays the same and doesn't add "www". Why is this? This is trivial since they both would access the same content, but I'd just want to know.

Share this post


Link to post
Share on other sites
Advertisement
You need to provide an automatic redirect in order to do this. How to do it depends on your server software. Gamedev uses IIS and so I am unsure how they do it but with Apache you can use a .htaccess file and create a simple redirect.

Share this post


Link to post
Share on other sites
Quote:
Original post by alnite
This is trivial since they both would access the same content, but I'd just want to know.
Bear in mind that some things do not carry over. For example; an AJAX application that tries to access a file on http://www.mysite.com/ will not let you do so if you are looking at the site from http://mysite.com. Also, I do not believe that sessions or cookies carry over between the two domains.

Share this post


Link to post
Share on other sites
When Opera doesn't find a site on the address you typed, it tries again prefixing www. to the adress.
But yeah, normally it's a server setting.

Share this post


Link to post
Share on other sites
Quote:
Original post by benryves
Also, I do not believe that sessions or cookies carry over between the two domains.


This is true and is the reason all forms of my domain redirect to the www version

Share this post


Link to post
Share on other sites
Quote:
Original post by Colin Jeanne
Gamedev uses IIS and so I am unsure how they do it but with Apache you can use a .htaccess file and create a simple redirect.

Do you know what the command is? I tried quite a bunch; some of them caused infinite loop, and none of them seem to work.

Share this post


Link to post
Share on other sites
OT: I found a site (forgot the domain name already) yesterday that didn't allow you to access it unless you typed the www. part. Wow, welcome to 1995, I swear I had a flashback. I've not actually typed the www part in over 6 years at this point. I figure if they cannot even get this part right, the rest of the site is likely poorly designed (by a someone lacking knowledge on the ways of the internet) and I won't likely need it :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Sander
Try:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.name [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.domain.name/$1 [L,R]

from: http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

You know what, I tried that, but it didn't work [cry]. I tried putting it in the .htaccess on the /www directory, not working. On the / directory, also not working. Both, also not working. I am very thoroughly confused now. The server reads the .htaccess file (I tried putting garbage in and it spits out a server error), but for some reason that code doesn't seem to have any effect.

Share this post


Link to post
Share on other sites
Quote:
Original post by alnite
Quote:
Original post by Sander
Try:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.name [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.domain.name/$1 [L,R]

from: http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

You know what, I tried that, but it didn't work [cry]. I tried putting it in the .htaccess on the /www directory, not working. On the / directory, also not working. Both, also not working. I am very thoroughly confused now. The server reads the .htaccess file (I tried putting garbage in and it spits out a server error), but for some reason that code doesn't seem to have any effect.


The server could be set to only read certain things from .htaccess files. One reason to do that would be to allow clients to use .htaccess for authentication but not for anything else.

Server side script redirect might be your only option. (other then switch web hosts)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!