httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Anton Mitterer <cales...@scientia.net>
Subject [users@httpd] cleanest/fastest way of redirecting aliases to canonical server names
Date Sat, 29 Jan 2011 01:38:54 GMT
Hi.

I'm having a vhost, which is reachable via one canonical name, e.g.
example.org, and also via several aliases, e.g. www.example.org,
example.com, etc.

I want that whenever requests are made via one of the aliases, that
those are redirected to the canonical name.


IMHO there are about the following two ways:
1)
- one vhost, which has the canonical name as ServerName, and the aliases
as ServerAliases
- and also has some RewriteCond+RewriteRules, making a redirect to the
canonical address if HTTP_HOST is one of the aliases.


2)
- two vhosts, the first having only the canonical name as ServerName (no
ServerAlias)

- the second, having the aliases as ServerName/ServerAliases
- and also doing a Redirect / http://example.org



Can (2) be handled with more performance by Apache than (1) (as it
doesn't have to evaluate the RewriteConds and the regexps every time?

At least (1) seems to be cleaner readable to me (from a config file
point of view)


Cheers,
Chris.

Mime
View raw message