Force Encrypted SSL Connection HTTPS Using The .htaccess File

Forcing visitors to use the secure encrypted SSL connection to your site is a good idea and can be accomplished through your .htaccess file using mod_rewrite.

All you need to do is add the following rule to the top of your .htaccess file:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.exampledomain.com/$1 [R,L]

Remember to replace exampledomain.com with your actual domain name.

This can be done on a WordPress or non-WP site where you can modify the .htaccess file.

Remove WordPress Version Number

Simply because of it’s adoption rate, WordPress sites have become a huge target for hackers. WP now runs more than 56% of all web sites on the Internet. It’s so awesome and flexible it is used by large corporations and for personal blogs. But it also gets a lot of attention from folks that have nefarious intentions.

One of the things hackers do to find easier targets, is look for WordPress sites running older versions that have known bugs in them. So the wonderful folks at Automattic continually update the WordPress code, not only to add functionality, but to fix bugs and strengthen it against attackers.

So, to state the obvious, one way to stay ahead of being the next victim is to use the latest version of WordPress. However, some of you may feel more comfortable by hiding the version number, something known as security through obscurity. Continue reading “Remove WordPress Version Number”

Stop Spambots From Scraping Email Addresses From Your WordPress Site With The AntiSpamBot Function

There are a few useful plugins that will do this, but I like to use as few plugins as possible and want to keep my site as simple and bloat free as possible.

The fine folks at WordPress have built in a function that prevents spambots from gathering email address from your site. And it doesn’t involve adding any plugin.

Spambots are programs designed to collect email addresses from various parts of the Internet. The goal is to build mailing lists for sending spam. Continue reading “Stop Spambots From Scraping Email Addresses From Your WordPress Site With The AntiSpamBot Function”

Insert Current Date and Time Within WordPress

To add the current date and time into a pages and posts on a WordPress site with a shortcode, first add this code to your Theme Functions (functions.php) file.

// Display the Date and Time
function displaydate(){
return date('F jS, Y');
}
add_shortcode('date', 'displaydate');

After you have modified the functions.php file, add the shortcode [date] anywhere you want the date to appear in a page or post. The above code will display the date.

To modify the look of the date and add the time displayed,  refer to the Formatting Date and Time page at WordPress.org.

If you want to display the date in a sidebar, you may need to further hack the Theme Functions file to enable shortcodes in text widgets.

Enable Shortcodes in WordPress Text Widget

In WordPress, shortcodes provide an easier way to add functionality in pages and posts areas of your website. By default, shortcodes do not work within sidebar and footer widgets.

Sometimes, theme designers add the functionality. Other times you may need to do it yourself.

Luckily it’s an easy WordPress Hack to enable shortcodes within a WordPress Text Widget. Just add the following code to your Theme Functions (functions.php) file:

// Enable shortcodes in text widgets
add_filter('widget_text','do_shortcode');

That’s it. Just one description line and one line of code.

Once the modified functions file is saved, add a Text Widget to a sidebar, add your desired shortcode, and you should be good to go.