【问题标题】:htaccess mod_rewrite is not working on 1&1htaccess mod_rewrite 不适用于 1&1
【发布时间】:2013-03-19 14:06:02
【问题描述】:

我的 webservers /marssolover/protected 文件夹中有一个 .htaccess 文件,它允许我从受保护的文件夹中获取文件并通过位于同一文件夹中的 filestreamer.php 文件对其进行流式传输。 mod_rewrite 在 localhost 上工作正常,但在 1&1 上不行。

我已经用 .htaccess 文件搜索并尝试了一些建议:

AddHandler x-mapp-php6 .php

RewriteEngine On
Options -MultiViews
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteBase /MARS/MARSSecure
RewriteRule ^(.*)$ filestreamer.php?file=$1 [L]

<Files .htaccess>
order allow,deny
deny from all
</Files>

但是,它仍然无法正常工作。我读过它可能与 MultiViews 有关,但我认为 Options -MultiViews

禁用了它

【问题讨论】:

  • 您是否检查过 1&1 是否在您的主机上启用了 mod_rewrite?
  • @atallon 他们确实支持它,他们的回答是“请注意我们的托管包支持该应用程序。”

标签: php .htaccess mod-rewrite apache2


【解决方案1】:

你可以试试这个:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !filestreamer\.php              [NC]
RewriteCond %{REQUEST_URI} ^/MARS/MARSSecure/(.*)/?        [NC]
RewriteRule .*   /MARS/MARSSecure/filestreamer.php?file=%1 [L,NC]

静默地图

http://example.com/MARS/MARSSecure/anything

收件人:

http://example.com/MARS/MARSSecure/filestreamer.php?file=anything

在测试期间尝试使用标志 [R,L,NC],以便您可以看到替换 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-04
    • 2013-07-25
    • 1970-01-01
    • 1970-01-01
    • 2010-12-20
    • 1970-01-01
    • 2014-06-04
    • 2011-12-12
    相关资源
    最近更新 更多