apache - 带有查询字符串的 Apache 2.4 .htaccess RewriteRule
问题描述
我已经尝试将 apache 从 2.2 更新到 2.4,毕竟我有问题让网站的某些部分在新的 apache 上工作。我有搜索功能,htaccess 看起来像
RewriteEngine on
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^search$ index.php?mode=search&q=%1&type=videos [QSA,L]
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^search/photos$ index.php?mode=search&q=%1&type=photos [QSA,L]
RewriteRule ^search$ search.php [QSA,L]
我在哪里犯错?在 apache 2.2 上,这条线工作正常,但在 2.4 上是空白页,日志中没有错误。
解决方案
问题已修复,默认启用 apache 2.4 MultiViews,这是造成问题的原因。禁用MultiViews后,搜索和重写按预期工作。
推荐阅读
- java - 如何检查用户输入是java中的float还是int?
- java - 工具栏幻灯片动画中的后退箭头不起作用
- java - 在java中以正确的方式获取“百分比哈希码”
- node.js - 使用 fluent-ffmpeg 添加背景音乐
- xml - 如何在不使用 OpenSAML Jar 的情况下解析 SAML 2.0 响应
- sql - 尝试将 SQL 查询的值分配给变量 SET
- jupyter-notebook - 如何使用 Julia 在 Jupyter Notebook 中抑制单元格的输出
- javascript - index.html:29 未捕获的 SyntaxError:意外的标识符
- python - 尝试解压非序列pylint(unpacking-non-sequence)
- laravel - Laravel invisible-recaptcha 安全吗?