non 'www' redirect to www.domain.com

  • caravan5
  • Novice
  • Novice
  • caravan5
  • Posts: 20

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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]
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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>
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Hmm, weird. We do it all the time, in fact we're doing it now. ;)
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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:
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

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.
  • caravan5
  • Novice
  • Novice
  • caravan5
  • Posts: 20

Post 3+ Months Ago

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 10 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.