如何使用htaccess将所有页面重定向到404

问题描述 投票:2回答:2

我想使用htaccess将网站上的所有页面(包括索引)重定向到404。预先感谢。

.htaccess rewrite
2个回答
1
投票

您可以在根.htaccess文件中使用此规则:

RewriteEngine On
RewriteRule ^ - [R=404,L]

0
投票

以下内容适用于较新的Apache:

Redirect 404

并且您可以添加消息而无需创建如下文件:

ErrorDocument 404 "Hmm... There's nothing here..."
© www.soinside.com 2019 - 2024. All rights reserved.