簡體   English   中英

.htaccess在本地工作,但不在1and1服務器上工作

[英].htaccess working locally, but not on 1and1 server

我將當前的.htaccess文件上傳到1and1服務器(實際上是1und1.de,但我猜它是一樣的)我正在調整500內部服務器錯誤。

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-Monitor時,我得到了- cgi: File not present or has invalid modes (no output)

現在唯一正在運行的文件是index.php

謝謝你的幫助!

實際上我解決了我的問題,在每個重寫規則的開頭添加一個斜杠,如:

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

代替

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

謝謝!

默認情況下,apache的htaccess權限已關閉或受限制,具體取決於您的主機。 懷疑你的Options -MultiViews導致錯誤。

檢查你的httpd.conf並檢查是否允許使用MultiViews ,如下所示。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM