You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Robert Andersson <ro...@profundis.nu> on 2004/09/01 11:14:14 UTC
Re: [users@httpd] mod_rewrite[SOLVED]
Joseph A. Nagy, Jr wrote:
> I have (temporarily) joseph-a-nagy-jr.homelinux.org as a ServerAlias of
> www.joseph-a-nagy-jr.us because they are indeed the same site, why have
> two different virtual host containers (e.g. twice the work)? Thanks for
the
> tip though, I know it'll come in handy eventually (I run several sites
from
> my server).
It is generally good to not have several URIs for the same resource(s).
That's why I think it is good to make a redirect from the alias to the
canonical hostname. To have two VHosts for each real host isn't really a
problem unless you run thousands of sites; it is simpler and faster than
involving mod_rewrite.
For each regular site I host, I use this scheme:
<VirtualHost *>
ServerName www.domain.ltd
...
</VirtualHost>
<VirtualHost *>
ServerName domain.ltd
ServerAlias *.domain.ltd
Redirect http://www.domain.ltd
</VirtualHost>
Regards,
Robert Andersson
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] mod_rewrite[SOLVED]
Posted by Robert Andersson <ro...@profundis.nu>.
Steffen Heil wrote:
> What is better / faster / less memory consuming ?
> mod_rewrite or mod_alias ?
It's very hard to tell which is faster without a real benchmark, mod_rewrite
needs alot more processing to do its work, and there is also a regex that
must be executed (and possibly also be compiled on the fly), which is pretty
expensive.
My bet would be that mod_alias is faster. That together with its simplicity,
makes it better IMO.
In memory consumtion, I don't think there isn't much different. I guess that
the data structure for a rewrite rule might be slightly larger than for a
Redirect directive, but probably insignificant.
Even though I love mod_rewrite, I think the general rule is to only use it
as a last resort. mod_rewrite can do almost anything, but specialized
modules/directives are generally more optimized for their task, as well as
easier to understand.
Regards,
Robert Andersson
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
AW: [users@httpd] mod_rewrite[SOLVED]
Posted by Steffen Heil <li...@steffen-heil.de>.
Hi
> ...
> <VirtualHost *>
> ServerName www.domain.ltd
> ...
> </VirtualHost>
> <VirtualHost *>
> ServerName domain.ltd
> ServerAlias *.domain.ltd
> Redirect http://www.domain.ltd
> </VirtualHost>
I use a similar scheme:
<VirtualHost *:80>
ServerName www.domain.tld
...
</VirtualHost>
<VirtualHost *:80>
ServerName domain.tld
RewriteEngine on
RewriteRule ^/(.*) http://www.eule-berater.de/$1
</VirtualHost>
I see some advantage in being able to have SOME virtual hosts, that don't
have the $1 in the end.
However, seeing your solutions makes me think, mod_alias would be better
suited.
What is better / faster / less memory consuming ?
mod_rewrite or mod_alias ?
Regards,
Steffen
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org