I think I have a canonical issue going on on my site, and I want to try and fix it. I want to use the (http : // www...) form. But I'm a bit confused... I've been doing a bit of research on it, and I think I need to install a .htaccess file. I have no idea how to do this... Though, perhaps I can just use 301 redirect? I don't know how to do this either though... So I was wondering if anyone can advise which is easier, or better to do... and how I do it... Or, is there a wordpress plugin that can do it for me? Any info is appreciated, thanks.
.htaccess only works if your server is apache so you maybe want to check that first. Then have a browse: http://www.google.co.uk/#hl=en&source=hp&q=what+is+htaccess
Oh, OK... I didn't know that, and to be honest that sounds wayy tooo technical... LOL Thanks fo rthe link though, Iwill take a look at that, and see what i can do. I did notice there was a worpress plugin, but the consensus is that it is broken, so I'm not sure if it's worth tyring to instal it or not. Thanks for the reply mcfox.
Yes, you would need to create an .htaccess file that would also work with Wordpress, which also uses .htaccess so it's a bit tricky. A plugin is probably the way to go.
Here's the code for Wordpress in case you decide to go for it with htaccess. You need to replace the existing block of Wordpress code in your htaccess file with code below. Redirect www.domain to non-www. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ [NC] RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Code (markup): and for non-www to www.domain # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Code (markup): OR If you are comfortable editing the htaccess, just add the two lines under RewriteEngine On to the existing code. These: or these (depending on whether you want www. or not) see above:
Thanks for that Mcfox... It looks a bit complicated however... and I'm not so sure I can do it without f*&^ing it up! I may have to do a bit more homework. LOL
Hehe. I know what you mean but the only way to learn is to have a go. Keep a copy of your htaccess file - rename it to htaccess-old or something so if it does go wrong all you need do is rename it back to .htaccess and you're good as new.