non-WWW domains and Wordpress

EZturnkey's picture

I've found a great plugin that will insure that your domain get's indexed as a www. This is pretty important since Google see's www's and non-www domains as 2 separate ones.

With my domains that are non-WWW, I had to hack the plugin. If you decide to use it, you must change the domain in this line to your own:
Code:
Header('Location: http://ezturnkeybusinessidea.com'.getenv('REQUEST_URI'));

You can then call the file prononwww.php and upload it to your WP plugin folder.

Here is the full code for the non-www domains. You can download the original www version at http://www.timlinden.com/blog/wordpress-plugins/pro-www/

Code:

<?php
/*
Plugin Name: Pro-non-www
Plugin URI: http://www.clixnetwork.com/wordpress-plugins/pro-www/
Description: Make sure users browse your site with a non-www in the url. Original Version by Tim Linden  http://www.nednil.com/
Version: 1.1
Author: Modified by Charles Amith
Author URI:http://ezturnkeybusinessidea.com
*/

// Copyright (c) 2005 Tim Linden. All rights reserved.
// http://www.clixnetwork.com/
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// This is an add-on for WordPress
// http://wordpress.org/
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************

if (strstr(getenv('HTTP_HOST'),"www")) {
  header('HTTP/1.1 301 Moved Permanently');
    Header('Location:  http://ezturnkeybusinessidea.com'.getenv('REQUEST_URI'));
    exit();
}

?>

Charles

rayd8's picture

Charles,

Getting a little off topic here but I have recently noticed some problems with Wordpress and images. I cannot display more than one image per directory on my Wordpress sites. I have checked Wordpress support but cannot find anything definitive as to a fix. Have you run into this problem? BTW I'm using Wordpress 2.0 for my sites.

Regards,

-Michael

EZturnkey's picture

I'm using more than 1 image from the same directory.

ie. domain.com/uploads/2006/12/myimagenames.jpg

When you upload a file through Wordpress, it puts it into the uploads directory, categorized by the year and month.

You should not have any issues as the post just refers to that path. I'm have the uploads directory set to 777 for permissions...and the same with the wp-content directory. I'm not sure if permissions is the issue.

Charles

Laura's picture

Quote:
This is pretty important since Google see's www's and non-www domains as 2 separate ones.


If you verify that you own the site in Google Sitemaps, you can tell Google that you prefer everything in that domain to be listed with or without the www.

EZturnkey's picture

Laura wrote:
you can tell Google

As I've done pretty well without letting Google know how often I update my sites, I have not used Google sitemaps in over a year.

I try not to give anything to Google that they don't need to know. In this case, I'll just give them something to feed on and a 301.

Charles

Syndicate content