Force HTTPS in htaccess and wp-config.php

Force HTTPS in WordPress by adding this to your htaccess-file, before the line “# BEGIN WordPress”.

 

Also, add this to your wp-config.php. FORCE_SSL_ADMIN is there to make sure there’s no redirect loop in wp-admin.

 

Automatically start MySQL if apache kills the process or sacrifice children on Ubuntu Server

There are several ways to solve the problem of Apache running wild and killing MySQL. It the problem occurs very┬áinfrequently, there’s a easy way of restarting MySQL with the use of the crontab. The script even sends a notification email so you know what just happened.

First, SSH into your server:

Create a script file:

Paste the following:

Press CTRL + O to save, and CTRL + X to exit.

Give execute permission to your script:

Edit the Crontab:

Paste the following:

Press CTRL + O to save, and CTRL + X to exit.

To see if it works, type the following:

In case the service doesn’t start, just start it manually with the following:

 

Remove query strings from static resources in WordPress

Remove query strings from static resources in WordPress by adding this to your functions.php. You can also change the substring “?ver” to anything else you want to remove.