non 'www' redirect to www.domain.com

  • caravan5
  • Novice
  • Novice
  • No Avatar
  • Joined: Nov 25, 2008
  • Posts: 20
  • Status: Offline

Post February 3rd, 2010, 3:10 am

Hi

I know this has been covered a lot, but can't seem to get an answer to my problem.

We'd like to point the non 'www' version of our domain to the 'www' version.

Using a 301 in the htaccess file doesn't work, so I've spoken to our hosting provider who have said: "it’s no longer possible to setup DNS rules to allow this, as Nominet and Internet Corporation for Assigned Names and Numbers (ICANN) now states that end users should enter www as this is the correct protocol identifier and it’s just lazy for the end user to not have the need to type www".

Does anyone know if this is true and if there's any way round it if a 301 doesn't work?

Thanks in advance
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 3rd, 2010, 3:10 am

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2675
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post February 3rd, 2010, 12:52 pm

Let me see if I understand this; you want
url.com to go to www.url.com?

If so, you can do this in DNS...

Just make your DNS zone file with
Code: [ Select ]
@      IN A   <ip address>

You can also use rewrites in apache.
Something like;
Code: [ Select ]
RewriteRule   ^(.*)$    http://www.url.com/$1   [R,L]
"It's always a long day, 86,400 won't fit into a short."
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13458
  • Loc: Florida
  • Status: Offline

Post February 3rd, 2010, 1:26 pm

Quote:
it’s no longer possible to setup DNS rules to allow this, as Nominet and Internet Corporation for Assigned Names and Numbers (ICANN) now states that end users should enter www as this is the correct protocol identifier and it’s just lazy for the end user to not have the need to type www


Well that sounds ridiculous to me, but given the retarded things I see in these situations sometimes I wouldn't put it past them. Seriously, "it’s just lazy for the end user to not have the need to type www", I'm using a freaking computer because I'm too lazy to write a letter by hand and walk to the mailbox for crying out loud!

There might be some rule preventing accredited ISPs from providing this at their DNS level, but that shouldn't have anything to do with what you're doing to the request after the domain name has already resolved to you.

If you can't get something like this to work in htaccess/httpd.conf, there's something wrong with your host.

APACHE Code: [ Select ]
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /
 
   ## non-www
   RewriteCond %{HTTP_HOST} ^domain\.com
   RewriteRule ^/?(.*)$ http://www.domain.com/$1 [L,R=301]
</IfModule>
  1. <IfModule mod_rewrite.c>
  2.    RewriteEngine on
  3.    RewriteBase /
  4.  
  5.    ## non-www
  6.    RewriteCond %{HTTP_HOST} ^domain\.com
  7.    RewriteRule ^/?(.*)$ http://www.domain.com/$1 [L,R=301]
  8. </IfModule>
Strong with this one, the sudo is.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2675
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post February 3rd, 2010, 1:29 pm

Hmm, weird. We do it all the time, in fact we're doing it now. ;)
"It's always a long day, 86,400 won't fit into a short."
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13458
  • Loc: Florida
  • Status: Offline

Post February 3rd, 2010, 2:15 pm

I imagine you guys are "grandfathered in" over there though, Daemonguy. Maybe new ISPs are getting this from new literature they have to read ?

I'm confused about this "Using a 301 in the htaccess file doesn't work" relating to the DNS response from the host. As far as I know, by the time you get to htaccess the DNS stuff has long been taken care of. :scratchhead:
Strong with this one, the sudo is.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Joined: Jan 23, 2004
  • Posts: 2675
  • Loc: Somewhere outside the box in Sarasota, FL.
  • Status: Offline

Post February 5th, 2010, 6:32 am

We don't exactly have 'an ISP', per se. :) Not unless you count the fully redundant array of 6 OC-192's we have connected directly to differing backbones. ;)

And re run our own DNS, obviously.

You are absolutely right Joebert; by the time the connection makes it to the webserver, DNS is long since done and out of the picture (barring any new lookups for redirects of course). A connection cannot even access an htaccess file, unless first DNS has resolved a name to an IP and sent that connection to the appropriate IP. So that makes no sense to me either.
"It's always a long day, 86,400 won't fit into a short."
  • caravan5
  • Novice
  • Novice
  • No Avatar
  • Joined: Nov 25, 2008
  • Posts: 20
  • Status: Offline

Post February 5th, 2010, 7:25 am

Sorry it makes no sense, but I'm not technical - I just update the website.

As I was getting nowhere with our hosting company I Googled doing a redirect and everyone seems to say a 301 is the answer. I was merely stating that this didn't work before I got loads of replies to the same effect.

So is the general consensus that my hosting company are wrong and it should be possible to sort via DNS?

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 27 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.