Hi, my main page contains the www. and I know that makes a difference, should I do a 301 redirect if you don't type www? Will that help me, in SEO terms? If it helps, how do I do it? I noticed I have a PR5 with and without the www, so I guess I could have a boost on www, right?
I do it and I like to do it so that way if anyone were to link to domain.com instead of www.domain.com, I still get all the benefits. Take a look at this yes, www.yes-www.org
add <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [L,R=301] </IfModule> to .htaccess then store in server root then test with phphosts.com and www.free-phphosts.com
Hi, thanks for the quick anwser, I already have the lines RewriteEngine On RewriteBase / on my htaccess Can I just add RewriteCond %{HTTP_HOST} !^www\.free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [L,R=301] ? Or do I need to add those lines <IfModule mod_rewrite.c> </IfModule> I don't really understand the code you give me, but why both have www? Well, I only added RewriteCond %{HTTP_HOST} ^free-phphosts.com RewriteRule (.*) http://www.free-phphosts.com/$1 [R=301,L] I think it worked, right? free-phphosts.com automatically goes to www, did I succeed, lol? How about /index.php goes to / ? By the way, is there any difference from http://www.free-phphosts.com/ and http://www.free-phphosts.com ?
Not trying to hijack your thread here, Webace, but rather then start a whole new thread I thought I might ask for some help implementing this into my .htaccess file too. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> Code (markup): If some kind soul would be generous enough to help me out then you will be handsomely rewarded with rep.
Don't forget the no-case(NC) flag in the rewritecondition that makes it case insensitive. The example below it has "! - sign" which means "if not", in the RewriteCond. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [L,R=301] </IfModule> Code (markup): You can just as well do it like this: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [R=301,L] </IfModule> Code (markup): And if you are putting .htaccess in your root folder you don't need "RewriteBase", unless - I think - if mod_alias or mod_userdir are involved... <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [R=301,L] </IfModule> Code (markup): If you already have RewriteEngine On you don't need that again. Also if you already have the if module statement the only interesting parts lines are these: RewriteCond %{HTTP_HOST} ^free-phphosts\.com [NC] RewriteRule ^(.*) http://www.free-phphosts.com/$1 [R=301,L] Code (markup): Just put them within your existing <IfModule mod_rewrite.c> </IfModule> Code (markup):
Thanks, kurtsfar. I had to tinker a little with the code to get it to work with mine but it pretty much did the trick.