Wordpress site redirect
I had the following problem lately: I added the typical rules to htaccess to redirect example.com/anything to www.example.com/anything, e.g.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule (.*)$ http://www.example.com/$1 [L,NC,R=301]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
But when I went to example.com I got infinite redirects…reason being I had the siteurl field in the wp_options table of the database set to http://example.com.
So, you need to change that to http://www.example.com, and also edit wp-config.php as follows:
define('WP_HOME','http://www.example.com');
define('WP_SITEURL','http://www.example.com');
That should be it - see here if not.
