apache - 添加重写规则后禁止访问
问题描述
我有一个在使用 Apache/2.4.7 的远程机器上运行的简单网络服务器,它在 public_html 文件夹中提供内容。我最初在.htaccess
文件中没有自定义配置。我在文件夹中有文件index.html
和offline.html
(以及其他一些 html 文件,但这两个足以解释我遇到的问题),当没有重写规则时,我可以毫无问题地访问它。当我将以下行添加到干净的 .htaccess 文件中时:
RewriteEngine on
RewriteRule . offline.html
当我尝试访问index.html
文件时,服务器开始给出禁止访问错误。但是,offline.html
当我尝试访问offline.html
. 我已经尝试寻找如何解决这个问题,但还没有找到解决方案。
加载的模块有:
core
mod_so
mod_watchdog http_core
mod_log_config
mod_logio
mod_version
mod_unixd
mod_access_compat
mod_actions
mod_alias
mod_auth_basic
mod_authn_core
mod_authn_file
mod_authz_core
mod_authz_host
mod_authz_user
mod_autoindex
mod_deflate
mod_dir
mod_env
mod_filter
mod_headers
mod_lbmethod_byrequests
mod_mime prefork
mod_negotiation
mod_php7
mod_proxy
mod_proxy_ajp
mod_proxy_balancer
mod_proxy_connect
mod_proxy_html
mod_proxy_http
mod_rewrite
mod_setenvif
mod_slotmem_shm
mod_socache_shmcb
mod_ssl
mod_status
mod_userdir
解决方案
推荐阅读
- c++ - VS2019 C++ 未知覆盖说明符
- laravel - Laravel - 此路由不支持 PUT 方法。支持的方法:GET、HEAD
- java - 此代码正确输出代码内部的汉字,而将从扫描仪捕获的汉字输出为垃圾
- javascript - 如何在 Vuex 中获取 json 数据的特定值?
- ios - 浅色状态栏样式不适用于 iPhone XS max 和 XR?
- android - 如何在 SharedPreferences 中使用上下文?
- unity3d - 为什么我创建的新画布会变得巨大且无法调整大小?
- javascript - 浏览器扩展/发送消息/如何在内容脚本尚未加载时捕获错误
- angular - 数据不显示在表格中,但它确实存在
- laravel - Laravel 注册文件上传