S将403和404错误重定向到主页htaccess的简单方法



正如标题所说,有什么简单的方法可以将每个被禁止的错误和找不到的页面重定向到我的主页index.php吗?

这是我的htaccess。我不认为它会有任何用处,但它在这里:

ErrorDocument 404 /leaguenotes/administration/cms/new_patch
ErrorDocument 403 /leaguenotes/administration/cms/new_patch
Options ALL -Indexes
RewriteEngine On
RewriteRule ^([0-9/.]+)$ index.php?Patch_No=$1 [NC,L]
RewriteRule ^([0-9/.]+)&([0-9a-zA-Z_-]+)$ index.php?Patch_No=$1&tab=$2 [NC,L]
RewriteRule ^patches php/patches.php [NC,L]
RewriteRule ^([0-9a-zA-Z_-]+)$ index.php?Champion=$1 [NC,L]

您可以在.htaccess:上添加这两行

ErrorDocument 404 /
ErrorDocument 403 /

这将把每个403404错误重定向到您的主页。

您可以在.htaccess文件上尝试此操作

ErrorDocument 403 "<meta http-equiv='refresh' content='0; url=your_redirect_page.html'/>"

最新更新