Archive for the ‘ WordPress ’ Category

WordPress HTTPS secure login

Back when I started with , I had to create server rewrites to force my browser to use HTTPS. That changed back in 2008, but this is the first i’ve heard of it.

WordPress 2.6 (released in July, 2008) and newer include the tools do do this out of the box! Using this documentation, you can get rid of some old .htaccess or nginx rewrite rules: http://codex.wordpress.org/Administration_Over_SSL.  All you have to do is add the declaration in wp-config.php:

define('FORCE_SSL_ADMIN', true);

This forces logins and administrative sessions to use SSL.

Now, you can remove the old nginx rewrites. They aren’t needed anymore:

rewrite ^/wp-login.php(.*) https://www.surlyjake.com/wp-login.php$1 permanent;
rewrite ^/wp-admin(.*) https://www.surlyjake.com/wp-admin$1 permanent;

WordPress Redirection Plugin

This blog is undergoing some changes.There is some content (like the zabbix pages) that I can no longer maintain since I no longer use them in my day-job. To keep everything working seamlessly, I wanted to create some 302 (permanently moved) redirectors for the content that I was taking down. In the past, I used a plugin called “smart 404” to intelligently redirect visitors to a good page instead of the dummy standard 404 page. Unfortunately, It looks like smart 404 is having some trouble in newer versions and wouldn’t create a smart suggestions on my 404 page.

Enter Redirection. Redirection gives you a menu in the admin interface which allows you to easily create and maintain 301 and 302 redirections (among other features). Here is a screenshot of what it looks like once activated:

From the screenshot, you can see that I was able to create a simple 301 redirect from a page on my WordPress instance to an external website where the content will live from now on.  The second rule allowed me to match the URL using a regular expression and redirect it to another page on my site. This is a great piece of software.

One issue I ran into when testing the plugin was that edits I made did not seem to be taking effect. This turned out to simply be my browser caching the 301 response. I recommend that you either manually clear the cache or download the web developer toolbar and disable cache.  I should also note that my server runs nginx and not the Apache web server. I simply deleted the redirection ‘module’ for Apache which attempts to create .htaccess rules to perform the redirections. Without the Apache module, WordPress handles the redirections.

Redirection Plugin documentation: http://urbangiraffe.com/plugins/redirection/