Website

Redirecting all pages to https://www…

To simplify URLs on sites I usually like to forward everything to an encrypted connection (HTTPS://) with the www subdomain. Here’s how you setup the Apache .htaccess for this. Just add the following lines to the top of the .htaccess file… RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} !^www. RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] …

Redirecting all pages to https://www… Read More »

Simple website backup script

I have used variation of this backup script for quick backups of typical LAMP stack websites (e.g. based on Drupal or WordPress). This saves the database along with the files into an archive… #!/bin/bash # Database connection information dbname=database_name dbhost=localhost dbuser=database_user dbpass=database_password homedir=/var/www/www.domain.com webrootdir=html # Default TAR Output File Base Name tarnamebase=website_backup-datestamp=`date +’%Y-%m-%d-%H-%M-%S’` cd $homedir …

Simple website backup script Read More »