Search code examples
apache.htaccessmod-rewriteurl-rewriting

.htaccess working locally, but not on 1and1 server


I uploaded the current .htaccess file to a 1and1 server (actually 1und1.de, but I guess it's the same) and I'm geting a 500 Internal Server Error.

Options -MultiViews 
RewriteEngine On
RewriteBase /lammkontor

RewriteRule ^categories/([^/\.]+)/?$ index.php?url=category.php&cat_url=$1 [L]
RewriteRule ^categories/([^/\.]+)/([^/\.]+)/?$ index.php?url=product.php&cat_url=$1&prod_url=$2 [L]
RewriteRule ^categories/([^/\.]+)/([^/\.]+)/recipes?$ index.php?url=recipes.php&cat_url=$1&prod_url=$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+\.php)/?$ index.php?url=$1 [QSA]

This .htaccess works perfectly on my local MAMP server.

When I test the CGI-Monitor in the control-center with an example file I get - cgi: File not present or has invalid modes (no output)

The only file working now is index.php

Thanks for your help!


Solution

  • Actually I solved my problem adding a slash to the beginning of every Rewrite Rule, like:

    RewriteRule ^(.+\.php)/?$ /index.php?url=$1 [QSA]
    

    instead of

    RewriteRule ^(.+\.php)/?$ index.php?url=$1 [QSA]
    

    Thanks!