Textpattern tips, tutorials and code snippets

Site links in SSL

In 2014, Google announced that it would change its ranking signal to rank sites that are SSL enabled a bit higher.

Textpattern has a great tag <txp:site_url /> which outputs the full URL to your site, but unfortunately does not feature a secure attribute.

Quick fix

Assuming you already have an SSL certificate installed on your web server, there is a quick fix you can apply to have all your site links https:// instead of non-secure http://.

As noted by Textpattern developer Stef Dawson on the Textpattern GitHub page, all one needs to do currently to deliver secure links is to add a definition to your config.php file, like so:

define('PROTOCOL', 'https://');

Example config.php file contents

$txpcfg['db'] = 'my_txp_db';
$txpcfg['user'] = 'my_txp_user';
$txpcfg['pass'] = 'my_password';
$txpcfg['host'] = 'localhost';
$txpcfg['table_prefix'] = '';
$txpcfg['txpath'] = '/my/path/to/textpattern';
$txpcfg['dbcharset'] = 'utf8';
define('PROTOCOL', 'https://');

At this time there is no way to have a portion of your site SSL enabled and a portion non-SSL. More information on Google and SSL in this article.