apache - htaccess 修改导致 ACCESS FORBIDDEN, ERROR 403 即使删除 htaccess 文件也无法纠正
问题描述
玩弄“友好的 URL”并创建了一个 htaccess 文件:
RewriteEngine On
RewriteRule ^modules/posts/questions_all.php/?$ modules/posts/questions_all.php [NC,L]
目的是能够将 http://localhost/modules/posts/questions_all.php/1234(带有友好的 URL 后缀 /1234)重定向到普通页面 http://localhost/modules/posts/questions_all.php
然后我尝试按照另一篇网络帖子中的建议添加其他行(但不了解它们的实际作用),使其成为:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^modules/posts/questions_all.php/?$ modules/posts/questions_all.php [NC,L]
在此之后,当我尝试通过 HREF 链接访问正常页面时,似乎开始收到“禁止访问,错误 403”消息。HREF 链接没有改变,但现在地址栏中的 URL 显示为:
http://localhost/C:/xampp/htdocs/Data/anyCompany/modules/posts/questions_all.php
而不是:
http://localhost/modules/posts/questions_all.php
现在,我似乎无法再通过此链接使系统恢复正常运行。即使删除 htaccess 文件也没有更正它。RewriteCond 命令是否更改了我需要以某种方式撤消的其他设置?
解决方案
不知道它是如何进入上述错误状态的,但是清除缓存解决了这个问题。没想到 .htaccess 文件会被缓存...
推荐阅读
- vue.js - 如何使用 Vuex 获取和设置值?
- ios - 在 AppSync 中获取“软件导致连接中止”
- javascript - 从 html javascript 中删除反斜杠
- r - R如何逐步将向量的元素相加?
- google-cloud-platform - 在 GKE 上安装 coredns
- java - OkHttp3 在慢速互联网上从不超时
- scala - 如何动态替换 Spark jar 中的类型安全包含语句
- c++ - 构建静态qt时未解决的外部问题
- symfony - Symfony,集合,多个实体,得到arrayCollection,需要实体
- ios - 如何使用 SwiftLint 排除 Pod 警告