Author Archive
-
-
Improving ‘time to first load’ and generating critical CSS for Drupal and WordPress sites
This document is a work in progress…. One thing that we want to fix is ‘time to first load’. As you probably know, people are recommending to put as little in the way of initial loading as possible, and zero external requests. This means no blocking JS in head, and as little CSS as possible, […]
Read more » -
Adding LetsEncrypt certs to a cPanel account with more than 100 domains using AutoSSL
We recently had to add Let’s Encrypt SSL certs to a cpanel account which contained over 100 parked domains (or domain aliases, as they are now called) The problem is that Lets Encrypt has a 100 domain limit for SAN certs (multiple domains on the same certificate). In reality that limit is 50, because you […]
Read more » -
Delete inactive Drupal users – sql query
Delete users who have no role assigned, created no content and who have not logged in in a few years: DELETE u.* FROM users u LEFT JOIN users_roles r on u.uid = r.uid LEFT JOIN node n ON u.uid = n.uid WHERE r.rid IS NULL AND n.nid IS NULL AND u.login < 1400000000 AND u.uid > […]
Read more » -
Export all 404 errors stored in Drupal database log
A drush command to export a text file with all 404s on your site and how often they occur: drush sql-query “SELECT count(*) as num_rows, message from watchdog WHERE type = ‘page not found’ group by message order by num_rows desc;” –result-file=404s.txt
Read more » -
WordPress: get all posts with no audio files attached
Useful SQL query for wordpress: SELECT p.post_title, p.guid FROM wp_posts p WHERE p.post_type = ‘post’ AND NOT EXISTS (SELECT * FROM wp_posts a WHERE p.ID = a.post_parent AND a.post_mime_type LIKE ‘%audio%’);
Read more » -
Generating thumbnails on the fly with WordPress
One advantage of Drupal’s resizing images over WordPress – WordPress’s resized images are generated at upload time only, whereas Drupal’s will be generated automatically on page load if the thumbnail doesn’t already exist. You could put this function into your WP template – given an image url $image_url, it checks for the address of its […]
Read more » -
Target Safari and Chrome with specific css
Sometimes you need to apply CSS rules to deal with Webkit browsers such as Safari and Chrome. One example: sometimes non-standard fonts rendered using @font-face or an embed service such as Typekit or Google webfonts display thinner than on other browsers. You can deal with this using a media query: @media screen and (-webkit-min-device-pixel-ratio:0) { […]
Read more » -
Searching for large files on your server
Here’s a command that will check the root / folder recursively for files greater than or equal to 1GB and sort the list. cd / ; du -h | grep ‘^[0-9]\+\.\?[0-9]\?G’ 2>/dev/null | sort -nrk 1 Thanks to Phil from WiredTree for sharing that info, I’m just putting it down here so I can remember […]
Read more » -
Redirect rules to change underscore to hyphen
Unfortunately Apache redirect only allows for 9 placeholders, so that’s the maximum amount of undercore changes that this code allows. We are using this mainly within WordPress sites, so here is the entire wp htaccess file, so you know where to position the code. # BEGIN WordPress RewriteEngine On RewriteBase / # BEGIN underscore to […]
Read more »
