Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Redirect for missing 'www' in URL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Chris  
View profile  
 More options Feb 28 2005, 4:45 am
Newsgroups: alt.apache.configuration
From: wee...@gmail.com (Chris)
Date: 28 Feb 2005 01:45:07 -0800
Local: Mon, Feb 28 2005 4:45 am
Subject: Redirect for missing 'www' in URL
Hi,  is there anyway I can redirect a user who has forgotten to enter
the www part at the beginning of a URL?

i.e I want to direct a user to the same content whether they enter
mysite.com or www.mysite.com

I'm using name-based virtual hosting and any help would be
appreciated.

Regards
Chris


    Reply to author    Forward  
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.
HansH  
View profile  
 More options Feb 28 2005, 7:39 am
Newsgroups: alt.apache.configuration
From: "HansH" <h...@niet.op.het.net>
Date: Mon, 28 Feb 2005 13:39:28 +0100
Local: Mon, Feb 28 2005 7:39 am
Subject: Re: Redirect for missing 'www' in URL
"Chris" <wee...@gmail.com> schreef in bericht
news:4d39f7c0.0502280145.b2f22c2@posting.google.com...
> Hi,  is there anyway I can redirect a user who has forgotten to enter
> the www part at the beginning of a URL?

> i.e I want to direct a user to the same content whether they enter
> mysite.com or www.mysite.com

First things first, both names has to resolve over DNS to the same IP.

> I'm using name-based virtual hosting and any help would be
> appreciated.

I'm using a rewrite in the _default_ virtual host:
    RewriteEngine on
    RewriteCond     %{HTTP_HOST} !^(www)\.
    RewriteCond     %{HTTP_HOST}  ^([^\.]+\.)?([^\.]+\.[^\.]+)$
    RewriteRule     (.*)  http://www.%2$1?d=1     [R=301,QSA,L]

The 'd=1' is only a reference logged with the redirected request by the
proper vhost.
( 'Using another Rewrite at the same vhost to take care of spelling errors
... like www.misite.com or www.myside.com and adds 'd=2' as marker )

For the default vhost you may want to append the host name to the log
    LogFormat "%h %l %u ....... \"%{host}i\"" combined-host

HansH


    Reply to author    Forward  
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.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google