In order to consolidate back link credit, and avoid a ranking penalty for duplicate content, I would like to redirect requests for my landing page from the www to the non-www version. I don't want to use .htaccess to redirect every page in the site, because there are scripts on my site which require the www prefix, so I only want to redirect the landing page.
I would prefer not to change the suffix of my landing page to php. I believe that .htaccess can be coded so that the Apache server treats all htm pages as php, but I don't know what unexpected effects that might have.
Here is the snippet which I would like to include in my landing page:
<?php if ($_SERVER['HTTP_HOST'] == 'www.mauitradewinds.com'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml
Please advise if, and how, this could work.