【问题标题】:htaccess - Get error the page isn't redirecting properlyhtaccess - 获取错误页面未正确重定向
【发布时间】:2018-01-05 21:11:32
【问题描述】:

我正在尝试使用此 .htaccess 文件将除某些文件类型之外的所有请求重定向到 download.php。

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI}  !(\.php|\.html|\.css|\.jpeg|\.jpg\.png|\.js)$
RewriteRule ^(.*)$ /download.php?url=$1 [L,QSA]

我已将此 htaccess 放在根文件夹中,我从 firefox 和 chrome 收到错误“页面未正确重定向”。如果我将 htaccess 移动到某个子目录中,则效果很好。请帮忙...

【问题讨论】:

  • 您是否检查过您的 httpd.conf 中是否存在任何可能不允许根目录中的 .htaccess 文件的问题?

标签: apache .htaccess


【解决方案1】:

尝试下一个代码。

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
Options Indexes
DirectoryIndex download.php       
order deny,allow
deny from *.php
deny from *.html
deny from *.css
deny from *.jpeg
deny from *.jpg
deny from *.png
deny from *.js

【讨论】:

    猜你喜欢
    • 2014-03-12
    • 2018-06-08
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多