How to Add www. – or Remove www. – From Your URL

This has been done many times by others, but just a quick tip on how to add or remove www. from your website’s address. This is helpful for URL canonicalization and user experience consistency. You can also achieve SEO-friendly canonicalization using rel="canonical". Oh boy, I’m getting too technical 🙂

Here’s the juicy part:

Add the following to the .htaccess file in your website’s root folder (often named public_html or www). If there’s not a file named .htaccess, you may create it. If you are creating the .htaccess file, set the permissions to 644. For security reasons, you don’t want others to be able to write to this file. Continue reading “How to Add www. – or Remove www. – From Your URL”

WordPress Comment Form 404 Error – Now Fixed!

Disabling the Cookies for Comments plugin broke the comments form.

On the recommendation of Matt Cutts, I added the Cookies for Comments plugin to this blog, and also added their recommended .htaccess modifications:

RewriteRule ^wp-comments-post.php - [F,L]

When I realized that Cookies for Comments was slowing down my blog considerably, I disabled the plugin, but did not think to  remove the .htaccess rewrite rule. The remaining .htaccess rules broke the comments on this blog (for two weeks now, could it be!?). Continue reading “WordPress Comment Form 404 Error – Now Fixed!”

SEO & Switching Domains

Goodbye old friend. Hello shiny new domain!

Recently I moved my company’s domain from to to reflect the change of the business name (over one year ago) from Katz Web Design to Katz Web Services, Inc., to reflect the in company services offerings, and to have a .com domain.

This is a simple switch, not re-launching a new website — just moving the same site from one domain to the next. Here’s how I approached the switch, and it’s a solid method to use for any domain switch: Continue reading “SEO & Switching Domains”

Redirect a Website in ColdFusion – Add www. or Move to New Domain

ColdFusion, BabyRedirecting a website in ColdFusion (.CFM)

I have been working on a ColdFusion website, and I wanted to find a way to require ‘www.’ in the URL (to consolidate all pages on www. for SEO). I normally work with PHP and Apache servers, so I’m used to .htaccess. I knew there had to be a way.

Here’s a simple method of redirecting a whole website in ColdFusion:

<!-- If the site isn't www... -->
<!-- Save the URL (and $_GET variables too) as the string 'strUrl' -->
<cfset strUrl = CGI.script_name & "?" & CGI.query_string />
<!-- Use 301 for SEO-friendly redirects -->
<cfheader statuscode="301" statustext="Moved permanently">
<!-- Redirect to new website (this case, added www.) with strUrl added on -->
<cfheader name="Location" value="">

Continue reading “Redirect a Website in ColdFusion – Add www. or Move to New Domain”

Use .htaccess to make all your HTML files PHP

Note: the following will not work on all server configurations, which may be why you’re using SSI in the first place. Call your server administrator/tech support and see if the following techniques are supported.

Escape static HTML

If you want the power and flexibility of PHP but don’t want to (or can’t) shift away from HTML, you can actually tell your server to read all HTML files as PHP by making one simple change to a file called .htaccess.

Here’s how:

  1. Create a file called .htaccess if you don’t have one already, and save it to your root folder
  2. Add one of the following pieces of code into your .htaccess file. Depending on your server configuration, one or the other should work…you’ll just have to try them out to see which one works for you:
    • AddType application/x-httpd-php .php .html or
    • AddHandler x-mapp-php4 .html .htm
      AddHandler x-mapp-php5 .html .htm
      (thanks to Florent V. below) or
    • <FilesMatch ".s?html?$">
      SetHandler application/x-httpd-php
  3. Save the file and upload it to your server.

Now, you’re able to use all of PHP’s goodness by adding one line of code!


GoDaddy-hosted websites should use AddHandler x-httpd-php5 .php .shtml .html .htm instead.