[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: best pactice - apache, rewrite, ssl, virtualhost or .htaccess



At 1154356892 past the epoch, Ernst-Magne Vindal wrote:
> I have tryed to redir with .htaccess file and by config
> virtualhosts. Both seams to work ok, but will be happy for
> some comments for best practice.

.htaccess is more relocatable, as you are keeping the
"logic" about your web app together with the rest of the
code. However it can be slower than defining things in your
httpd.conf files, as apache has to reparse the .htaccess
files with each request. I'd suggest sticking with .htaccess
until a time when you find performance to be a problem.

> Another thing is redirection, virtualhosts and url's.
> I have not managed to redir http://webmail.domain.com to
> https://webmail.domain.com. "webmail" is a virtualhost.

It looks (from below) like you are using rewrite for this.
For such a simple redirect, I'd suggest using
'RedirectMatch' instead. I do this by specifying a
VirtualHost block for port 80 traffic, which does nothing
but redirect to HTTPS:

  <VirtualHost *:80>
    RedirectMatch permanent ^/(.*)$ https://webmail.domain.com/$1
  </VirtualHost>

-- 
Jon Dowland
http://alcopop.org/



Reply to: