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/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • RE: htaccess woes
    ... Apologies - I am VERY new to Linux and am learning ... > Make sure your file .htaccess got the correct access rights. ... > to protect the phpMyAdmin folder with .htaccess. ...
    (RedHat)
  • Is there anyway to make decisions in Htaccess.
    ... Is there any capability of decisions in htaccess. ... In other words I want to redirect the visitor to one of many pages via ... I need to put the random selection in a variable like $var then append ... RewriteRule happy http://www.othersite.com/$var ...
    (comp.lang.javascript)
  • Re: "Nice URLs" - how to implement it in PHP?
    ... "Nice things are nicer than nasty ones." ... 10 rules in .htaccess which redirect you to normal URLs with GET ... I tend to just redirect all requests (except a few specific directories ...
    (comp.lang.php)
  • Re: URL Redirection problems
    ... (particularly 301 - Permanet redirect). ... access to the web server config file and, as this is a rather cheap ... or FTP program because ".htaccess" has a period at the beginning. ...
    (comp.infosystems.www.servers.unix)
  • Re: Removing obsolete pages from a site
    ... In <.htaccess> add this type of directive: ... Redirect permanent /oldpage.php http://example.com/newpage.php ... sound like much and was mainly worried about search engine references. ...
    (alt.html)