I like 1and1.es hosting service, but it has a strange problem: the .htaccess failures. Yes, i mean that if you copy a website from somewhat server to an 1and1 server, and the .htaccess was working fine in the previous server, now the same .htaccess in the 1and1 server will probably fail. Why? I don't know, but do a Google search of "1and1 .htaccess" and you will find tons of messages reporting failures. This is "my failure" and the solution:
I have a subdirectory, lets say "http://www.server.com/subdir". In this subdir, i have a .htaccess file for the web site on that subdir. I have a file called "contact.php" and i wanted a nice url like: "http://www.server.com/subdir/contact/", very straightforward. I wrote the .htaccess:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /subdir
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^contact/$ contact.php [NC,L,QSA]
very easy, but it gives an 404 error. then i tried to rewrite all:
RewriteRule ^(.*)$ contact.php [NC,L,QSA]
And here comes the fun part, if i write "http://www.server.com/subdir/contact/", it gives an 404 error, but if i write "http://www.server.com/subdir/foo/" (or whatever except "contact"), it runs right!. So, the system does not like that you rewrite an URL with a file with the same name, is this strange? So, if "^contact/$ contact.php" does not run, i will rename the file like "h_contact.php", so finally the .htaccess will be:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /subdir
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^contact/$ h_contact.php [NC,L,QSA]
so if i write now the URL "http://www.server.com/subdir/contact/" now works right. A 1and1 strangeness.