.htaccess works locally, but not on server 1and1

I uploaded the current .htaccess file to server 1and1 (actually 1und1.de, but I think it is the same) and I get 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 fine on my local MAMP server.

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

Now the only file is index.php

Thank you for your help!

+4
source share
2 answers

Actually, I solved my problem by adding a slash to the beginning of each Rewrite rule, for example:

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

instead

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

Thanks!

+10
source

By default, apache htaccess permissions are disabled or limited depending on your host. I suspect your Options -MultiViews is causing an error.

Check httpd.conf and make sure that MultiViews enabled as shown below.

 <Directory /> Options FollowSymLinks AllowOverride Indexes Options=All,MultiViews Order deny,allow Deny from all </Directory> 
+1
source

Source: https://habr.com/ru/post/1490005/


All Articles