The sharp-eyed among you may have noticed that we very recently updated a couple of things here at the Silicon Dales website, and one of those steps has involved switching from delivering pages via HTTPS, now that we have retired the online shop section.
The precise mechanism for doing this on a LAMP setup using .htacess is as follows:
Redirecting HTTPS traffic to your HTTP domain – using .htaccess
Add the following code to your .htaccess file
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
Some Points
Using [R=301,L]
A couple of commentators in a few places have mentioned that you don’t need to add the “L” (last) directive, but we have found that the code doesn’t work as desired unless you add this directive.
Why .htaccess not httpd.conf?
It is faster, and desirable, to add redirect codes to your httpd.conf file rather than using .htaccess, for speed of service, but we have balanced this against the ease of updating that .htaccess affords. In particular, we have done this because we use caching (via W3 Total Cache) which utilises .htaccess quite extensively, and the speed gains we make through this smart caching system are significantly more than we would make without it using httpd.conf. When W3 Total Cache is very stable, we will drop the directives it creates into httpd.conf and speed things up further: in testing, this has caused issues upon updating plugins.
How To Edit .htaccess Easily Within WordPress
Naturally, it is fairly easy to edit .htaccess by SSH’ing into your server instance, and typing “vi .htaccess” and then editing this file. However, that’s not always the easiest way to go about things for all webmasters. We almost always install the excellent WordPress SEO plugin by Yoast (Joost) onto WordPress, and this comes with a super-handy “edit files” option, which allows you to edit your .htaccess within the WP admin. You’ll find the option under SEO in your WordPress admin menu, or at http://yourdomain.com/wp-admin/admin.php?page=wpseo_files
Did You Do Anything Else?
Obviously, after we’ve changed the site structure in this way, we needed to tell WordPress to use http:// rather than https:// – we altered this in the “Settings” menu of WordPress.
We also used MySQL Find & Replace to replace all instances of “http://silicondales.com” with “http://silicondales.com” and effectively alter all of our internal links.
We had to then change anything which was hard linked in the menus and the image slideshow at the home page too.
Essentially, any links which point to the https version should be altered to no longer point there, in the fastest possible way!
Your questions and comments?
Got questions? Leave them below. Got a comment (like “great, this worked for me!)? Leave it below.