httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Warwick" <>
Subject RE: Redirecting URLS...
Date Thu, 15 Aug 2002 21:00:21 GMT
First, I think that the convention of starting web addresses with 'www.'
is annoying. It is easier to say 'amazon dot com' than 'w w w dot amazon
dot com' or worse still 'dub dub dub amazon dot com' as some are
beginning to do. Our company as a policy dumps the 'www' and enforces
lowercase in the domain name, using an external redirect the correct
name for our website is displayed in the browser and in the

The solution I use is mod rewrite which can run in .htaccess provided
you host has the module loaded. Try http://WWW.Argest.Co.NZ to see how
it works (It works for either .com or suffixes).

The relevant lines are:

#s&t customisations:
#enforce lowercase domain name
RewriteMap lowercase int:tolower
RewriteCond %{HTTP_HOST}   .*[A-Z].*
RewriteRule ^(.*)          http://{lowercase:%{HTTP_HOST}}$1   [R] 

#strip www - permanent [R=301]
RewriteCond  %{HTTP_HOST}   ^www\..*$
RewriteRule  ^(.*)          %{HTTP_HOST}$1                     [C]
RewriteRule  ^www\.(.+)     http://$1                    [L,R=301]


-----Original Message-----
From: Matthijs Rohs []
Sent: Friday, 16 August 2002 1:32 a.m.
Subject: FW: Redirecting URLS...

-----Oorspronkelijk bericht-----
Van: Matthijs Rohs [] 
Verzonden: donderdag 15 augustus 2002 15:31
Aan: 'Boyle Owen'
Onderwerp: RE: Redirecting URLS...

Thnx :) one thing though:

When I put this in my .htaccess (mod_rewrite is loaded):

RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !^/home/
RewriteRule (.*) /home/$1

Then when someone loads that person will see what's
in so it is possible with .htaccess.

So I thought it was possible, with mod_rewrite for example, to do the
same with to

Guess not according to you :)


-----Oorspronkelijk bericht-----
Van: Boyle Owen [] 
Verzonden: donderdag 15 augustus 2002 15:26
Onderwerp: RE: Redirecting URLS...

>From: Matthijs Rohs []
>It's not on my own server, so I need to place it within .htaccess and
>not httpd.conf. What's the solution for that please?

I'm trying to figure out what you have here... Do you have a website
which is hosted by an ISP and you only have write access to your
document root (so can edit .htaccess files). But you cannot edit the
server config? Then the ISP has directed to your site but
you want other variants to go there too?
(If so, you could have said so to begin with...)

In any case, the simplest solution is to use the ServerAlias but you
cannot do that in .htaccess. This is not something you can do yourself -
you need your ISP to edit the server config as previously described. so
there is no "solution".

Think about it - if you could do what you want in .htaccess, you could
hijack anybody's site (just make point to :-)


Owen Boyle

To unsubscribe, e-mail:
For additional commands, e-mail:

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message