Skip to Content.
Sympa Menu

cc-devel - Re: [cc-devel] apache 101 - stripping off the www

cc-devel AT lists.ibiblio.org

Subject: Developer discussion for Creative Commons technology and tools

List archive

Chronological Thread  
  • From: "Nathan Kinkade" <nkinkade AT creativecommons.org>
  • To: "Mike Linksvayer" <ml AT creativecommons.org>
  • Cc: cc-devel AT lists.ibiblio.org
  • Subject: Re: [cc-devel] apache 101 - stripping off the www
  • Date: Sun, 13 Jul 2008 12:39:47 -0700

2008/7/13 Mike Linksvayer <ml AT creativecommons.org>:
> On Sun, Jul 13, 2008 at 12:23 PM, Nathan Kinkade
> <nkinkade AT creativecommons.org> wrote:
>> Here's what we use for creativecommons.org (requires mod_rewrite):
>>
>> RewriteCond %{HTTP_HOST} =www.creativecommons.org
>> RewriteRule ^/(.*)$ http://%{SERVER_NAME}/$1 [L,R=301]
>
> There's a website dedicated to just this, btw -- http://no-www.org :)
>
> Mike
>

Interesting. Their approach was slightly different from the one I
implemented for (cc).org. I guess it just goes to show that there's
more than one way to skin a cat (and also to strip the www from a
domain):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

I should also note that the approach I listed above is meant to work
from the vhost configuration file, not from an .htaccess file. To
make it work in an .htaccess file change the RewriteRule to:

RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [L,R=301]

Nathan




Archive powered by MHonArc 2.6.24.

Top of Page