Hey, I’m trying to redirect example.com (and example.com/, www.example.com and www.example.com/) to example.com/subdirectory. I could do this easily using HTML but from what I read, it’s better to make a 301 redirect using Apache. However, I’m having a hard time finding documentation on how to do this.
                +1 
                A: 
                
                
              
            You should use a .htaccess file using the RewriteRule keyword. See Apache docs for more info on how to do this.
                  CFP
                   2010-06-07 21:53:17
                
              Thanks, this works like a dream!
                  Frode
                   2010-06-07 22:05:33
                
                
                A: 
                
                
              
            Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Source: http://www.webconfs.com/how-to-redirect-a-webpage.php
Example usage would be
RewriteRule ^/$ http://somewhere.com/directory [R=301,L]
I guess
                  Robus
                   2010-06-07 21:53:30