So if I used this code what do I change and do I just paste it into the .htacess file? RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R] Code (markup):
Fair enough....I thought about this and it seems it would do the samething. I have to assume the mod url is less taxing on the server than the 301 but not sure.....why would there be two seperate instuctions from Apache and W3C?? One thing you have to remember is Google is using the code through their server... and that might not be the best thing for your site / server.
1. You MUST use a 301 redirect for this to work properly, particularly if the search engines have indexed two versions of the site's URLs. A 301 tells the spider that the change is permanent, which causes the search engine to replace the old URL in their database with the new. It is used to assure that spiders do not double index a site under two different versions of a URL, which can sometimes lead to duplicate content issues. The search engines are supposed to figure this out through a process called Canonicalization, but they don't always get it right. Here is the definitive word from Matt Cutts: http://www.mattcutts.com/blog/seo-advice-url-canonicalization/ 2. swollenpickles, do not use that code literally. It will not work until you plug your domain name into it. 3. This is the correct version. You need to escape the dot in the RewriteCond statement with a backslash and force a 301 in the RewriteRule statement. You can force a 301 by using either R=301 or R=permanent. You may or may not need the first line, depending upon your server configuration. I always place it in the .htaccess file as the first lines of code in every site I set up. Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] Code (markup): 4. You must verify that a 301 status code is being generated. Use one of the online header checkers, such as http://web-sniffer.net/. 5. The .htaccess file only works on Linux and Unix servers running Apache. 6. The .htaccess file is a hidden file, which means you may not see it with your FTP utility. If you cannot see the file, read this article for tips regarding how to make the file visible to your FTP tool. Why can't I see my .htaccess file with WS_FTP or CuteFTP? 7. You MUST use a plain text editor, such as Notepad, when working with this file. Using Word or editors that attach headers or formatting code may screw it up. 8. Placing this code in the .htaccess file does not make it server intensive. The .htaccess file is a type of filter. With mod_rewrite, no action is taken unless the conditions are met. Yeah, you can overload the .htaccess file, but if this is all that you are doing, it will not bog down your server.