Blog

By Enrique González

.htaccess and 1and1 servers

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:

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:

so if i write now the URL "http://www.server.com/subdir/contact/" now works right. A 1and1 strangeness.

Date08-08-2010

0

comments

+

Leave a comment

Name

E-mail

Comment

The comments sent by each user will always be visible in the corresponding post, and will not be used for any other purpose. The user has the right to access, rectify and suppress said comments, as reflected in our Privacy Policy