首页 > 解决方案 > 添加重写规则后禁止访问

问题描述

我有一个在使用 Apache/2.4.7 的远程机器上运行的简单网络服务器,它在 public_html 文件夹中提供内容。我最初在.htaccess文件中没有自定义配置。我在文件夹中有文件index.htmloffline.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

标签: apache

解决方案


推荐阅读