Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Adding (or removing) "www" without mod_rewrite
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
RSL  
View profile  
 More options Sep 5 2008, 10:03 am
From: RSL <sco...@gmail.com>
Date: Fri, 5 Sep 2008 10:03:03 -0400
Local: Fri, Sep 5 2008 10:03 am
Subject: Re: Adding (or removing) "www" without mod_rewrite

Here's what I'm using:

# before_filter :trim_www

def trim_www
  if request.subdomains.first == "www"
    if request.subdomains == ["www"]
      redirect_to "#{request.protocol}#{request.
domain}#{request.port_string}#{request.path}"
    else
      subdomains = request.subdomains.shift.join(".")
      subdomains << "." unless subdomains.blank?
      redirect_to
"#{request.protocol}#{subdomains}#{request.domain}#{request.port_string}#{r equest.path}"
    end
  end
end

RSL

On Fri, Sep 5, 2008 at 3:42 AM, Scotttt <scot...@gmail.com> wrote:

> > I believe so, but there was a discussion here recently asking whether
> > that's the only reason why and, if not, what the other problem cases
> > were. I don't recall seeing an answer to that, so there might be edge
> > cases that could be thrown up by reactivating it. It's certainly worth
> > a try though.

> > Many thanks to Andrew and RSL, I hadn't thought of doing it at the app
> > level but that makes sense - thanks!

> > Pete

> Hi Pete -

> Have you written any code for this yet? Would you share if you have?
> I'm looking at the same issue and was going to put something together
> tomorrow, but if you've already solved it, so much the better. I think
> this may become a popular thread over time. :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.