Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.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!

like image 1000
denoise Avatar asked Dec 03 '22 22:12

denoise


2 Answers

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!

like image 104
denoise Avatar answered Jan 14 '23 13:01

denoise


By default apache's htaccess rights are off or limited depending on your host. I suspect its your Options -MultiViews causing the error.

Check your httpd.conf and check that MultiViews is allowed like below.

<Directory />
  Options FollowSymLinks
  AllowOverride Indexes Options=All,MultiViews
  Order deny,allow
  Deny from all
</Directory>
like image 29
Panama Jack Avatar answered Jan 14 '23 12:01

Panama Jack