Redirect www to non-www with .htaccess file

It occurred to me that just maybe you don’t want to display your site with the www subdomain prefix. In that case you could deploy the following code in your .htaccess file to redirect www to non-www. By doing so, users will access your site at not


If your website is hosted on an apache server, a redirect from www to non-www is a simple implementation. Add the following to your .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com
RewriteRule (.*)$1 [R=301,L]

Add the above code to you .htaccess file and replace with your domain name.

This post is a follow-up to a similar adrticle on how to redirect non-www to www with .htaccess.

How To: PHP to Display Current Year

An alternative method to using jQuery to display the current year would be to get the date server side with a language like PHP. If your web hosting can run PHP you can deploy the following PHP code to display the current year.

<?php echo date('Y'); ?>

Printing the current year on the page with a PHP script is commonly used to display a copyright year in the footer.

Current year isn’t the only format the PHP date() can display. Visit the date function page on to see the other formatting parameters.

How To Update Facebook Open Graph Cache

Have you ever tried to post a link to your content on Facebook only to realize that an image is missing or the description isn’t there?

Naturally, you go back to your edit your article and add the missing content. Then you head back to Facebook and try to post the link. What, Facebook still isn’t showing the new content? Why? It is caching the Open Graph data!

How can you get Facebook to update cache data on a link?

  1. Go to the Facebook Open Graph debugger (
  2. Enter the URL of your link and click Debug
  3. Verify that the updated content is being fetched by Facebook in the “Object Properties” area
  4. If the new content is there, return to Facebook to add your link

In my experience this process has updated the Open Graph cache on Facebook every time.

Disclaimer: this is not a documented process by Facebook.

What is Open Graph?

Learn more at