I need a code to work this... i've googled and tried all the top .htaccess codes... and it ended up refreshing the page 5-6 times and firefox says redirection error.. Please give an exact code for this
This code works just fine for me. It redirects domain.com/folder to www.domain.com/folder (forgive me, I can't post http:// links) Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yoursite.com [NC] RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] Code (markup):
This is slightly different then the one above but works for all pages on my site. I bolded the difference. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yoursite\.com$ [NC] RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
I am not positive if Word Press has this option built in or not. But yes will work for any site. Simply add this code to the .htaccess file which is located in the root directory of your website. Usually named the public_html folder.