500 Errors With 1and1 Hosting/Apache 1.x
When I uploaded a Cake-based site to a 1and1 shared hosting account, I got some mysterious 500 errors despite the site working perfectly on my dev machine.
I don't know if 1and1 is just weird or if it's an Apache 1.x issue but when I uploaded my Cake-based site from my dev computer where it was working perfectly running on Apache 2.x to my 1and1 account, I was getting 500 Internal Server Errors.
What worked for me was to change the three .htaccess files as follows:
root .htaccess file
app/.htaccess
app/webroot/.htaccess
Note the added slashes. Also, this works for when Cake is the root folder of your website, i.e. you simply go to www.example.com, not www.example.com/path/to/cake.
If you do have your site in a sub-folder, like www.example.com/path/to/cake, use the following instead:
root .htaccess file
app/.htaccess
app/webroot/.htaccess
Hope this saves someone days of frustration.
What worked for me was to change the three .htaccess files as follows:
root .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /app/webroot/ [L]
RewriteRule (.*) /app/webroot/$1 [L]
</IfModule>
app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /webroot/ [L]
RewriteRule (.*) /webroot/$1 [L]
</IfModule>
app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>
Note the added slashes. Also, this works for when Cake is the root folder of your website, i.e. you simply go to www.example.com, not www.example.com/path/to/cake.
If you do have your site in a sub-folder, like www.example.com/path/to/cake, use the following instead:
root .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /path/to/cake/app/webroot/ [L]
RewriteRule (.*) /path/to/cake/app/webroot/$1 [L]
</IfModule>
app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /path/to/cake/app/webroot/ [L]
RewriteRule (.*) /path/to/cake/app/webroot/$1 [L]
</IfModule>
app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /path/to/cake/app/webroot/index.php?url=$1 [QSA,L]
</IfModule>
Hope this saves someone days of frustration.

root .htaccess file contents
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L]
app/.htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^$ /webroot/ [L] RewriteRule (.*) /webroot/$1 [L]
app/webroot/.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L] php_flag magic_quotes_gpc Off
If I go to subdomain.mydomain.com I get a 500 error
If I go to www.mydomain.com/subdirectory it works.
example:
RewriteEngine on
RewriteBase /dev/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
can someone help me.. I tried it.. but for me it doesn't work... also I tried use RewriteBase, both cases the same result.. the 500 server error don't go away...
thanks in advanced..
I use other way.
if project in directory domain.com/project/ <- this is root of the project then in .htaccess you should add
RewriteBase /project/
also don not forget about php5 !
to switch on add in .htaccess
AddType x-mapp-php5 .php
Thank you :)
- Kien
I'm trying to upload something to www.example.com/subdir, using 1and1.
If I go to: http://www.example.com/subdir (without trailing slash) I get
this error:
But if I add the trailing slash everything works fine. And in my local environment works flawlessly. I'm kind of clueless. Any ideas?
And what's that Künden Controller?
Thanks in advance!
root .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
And this way, you can just change the RewriteBase quickly to /path/to/cake later or back again and you only had to edit one line per file, instead of two (or more for other applications). Unless you disagree, I think you should reflect this in your article.