Redirect non-www to www in Wordpress

For years now, search engines have been struggling with the different variations of domains. For some off reason requests for www.seoweblog.com, seoweblog.com and seoweblog.com/index.php, while obviously return the same page, get indexed as 3 different pages…

The consequinces: Pagerank splits, Backlinks split and lastly you’re risking getting filtered for duplicate content by the new filters at Google.

Over at b5media, we’ve been looking for a way to redirect all non-www request to the appropriate variation of the address, and since all blogs run Wordpress it’s been a challenge to do it through the software itself rather than through the Apache server settings.

Last week, Matt introduced a plugin that takes all requests for the www version of a site and return a consistent non-www address with the appropriate redirect methods. The plugin, while working good, is only a partial solution as it does not include the index.php requests.

I took the same plugin and created a complementary, improved version of it. Since I like to have all www addresses, I’ve redirected all non-www to www and all index.php to /.

So far it seems to work fine, however, I’m open for suggestions, comments or complaints…

Download: yes-www.zip

Installation Instaructions:

1. Unzip the file.
2. Upload to your Wordpress plugin folder.
3. Activate from within Wordpress admin.

Updates:

Date Version Changes
9/10/2006 0.30 The plugin caused an error when using the wp theme editor. Aparently, it caused an endless redirection loop when editing the homepage. Anyways, now it doesn’t…
6/20/2006 0.20 Previeus version did not process GET queries such as search queries… Added processing for queries and rewrote plugin for smaller / faster version. (Thanks Aaron for your contribution)
6/19/2006 0.10 First version, my first plugin ever, may lack be missing some details, please let me know if anything is not-working / missing.