Apache: How To Redirect http to https

If you want to direct traffic from your http so that it gets encrypted, this is really easy to do in Apache:

Step one: Set up your https vhost:

<IfModule mod_ssl.c>
<VirtualHost 10.1.1.1:443>
</VirtualHost>
        DocumentRoot /var/www
        # other server options go here as needed, logging for example
        SSLEngine on
        SSLCertificateFile    /etc/ssl/certs/example.cert
        SSLCertificateKeyFile /etc/ssl/private/example.key
        # Add other SSL specific options as needed
</IfModule>

Step two: Set up your http vhost:

<VirtualHost 10.1.1.1:80>
ServerName my.example.com
RedirectPermanent / https://my.example.com/
</VirtualHost>

We have previously posted more information on enabling SSL in Apache.

Obviously, instead of 10.1.1.1 and my.example.com you’ll have to use your own IP and hostname, whatever they may be.

Note that this will redirect everything from http to https. Finer control is possible, for example you could do:

RedirectPermanent /secure/ https://my.example.com/secure/

Or you could use RewriteRules for even more control. However, in the age of mass surveillance and constant threats from hackers, a general redirect to https is a good idea.

Could not perform immediate configuration on ‘python-minimal’

When I tried to update my Debian box, I got the following ominous error:

E: Could not perform immediate configuration on ‘python-minimal’.Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)

It turns out that the fix/workaround/whatever you want to call it is fairly simple. The following worked for me:

apt-get install -o APT::Immediate-Configure=false -f apt python-minimal

 

Creating New Outlook .PST Files in Office 2010

Back in the good old days, I am pretty sure, all the PST related stuff was in the normal file menu. Not anymore. I wanted to create a new PST file and I had to look quite a while before I found it – Microsoft has it hidden quite well:

Outlook PST Menu Location

Outlook PST Menu Location

It’s in the Home ribbon, under “New Items -> More Items -> Outlook Data File”.

I never liked those Ribbons, but anyway, maybe this will save someone else ten minutes.

WordPress – Images not displaying, Redirects not working

Moved my wordpress to a new server. I kept all paths etc intact, copied my VirtualHost and permissions were good, so I was at first surprised when my images didn’t show and redirects didn’t work. The cause was quickly found, however; it seems my old install had different settings hidden somewhere in the Apache configuration.

I guess there may also be different causes, but in my case I fixed it by adding this to my WordPress VirtualHost:

<Directory "/var/www/wordpress/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

/var/www/wordpress is obviously the DocumentRoot of my WordPress install.

Hope this helps.