2013-07-06 86 views
4

我将当前的.htaccess文件上传到1and1服务器(实际上是1und1.de,但我想它是一样的),并且发生500内部服务器错误。.htaccess在本地工作,但不在1and1服务器上

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] 

这个.htaccess可以在我的本地MAMP服务器上完美工作。

当我测试的CGI-监测控制中心用一个例子文件,我得到 - cgi: File not present or has invalid modes (no output)

的唯一文件的工作现在的index.php

感谢您的帮助!

+0

看看你的apache日志,它通常会告诉你更多关于为什么会有500错误的细节。 –

+0

1.通过访问文件url确保文件实际存在。 2.确保文件具有正确的权限。如果1有效,那么2应该没问题。 –

+0

尝试删除'选项-MultiViews',看看你是否仍然得到500错误,那么它不会得到500,你的httpd.conf中可能有配置差异 –

回答

1

默认情况下,apache的htaccess权限已关闭或受限于您的主机。 我嫌疑人其你的Options -MultiViews导致错误。

检查您的httpd.conf并检查MultiViews是否允许如下。

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

感谢您的输入... – denoise

9

其实我解决我的问题增加了斜线的每一个重写规则的开始,如:

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

,而不是

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

谢谢!

相关问题