重定向否认| htaccess的重定向、htaccess

2023-09-02 00:36:22 作者:小男人、有点小自恋ゞ

我怎样才能得到,如果他们的IP是相匹配的IP地址的拒绝该用户被重定向,如:

How can I get the user to be redirected if their IP was matched on the deny of an IP address, e.g.

<Limit GET POST PUT>
  order allow,deny
  allow from all
  deny from {removed IP address}
</Limit>

我需要他们重定向到当他们访问被拒绝特定网站。

I need them to be redirected to a specific website when they are denied from accessing.

这个需要帮助的..

推荐答案

安装脚本中添加这一行到你的.htaccess处理403错误:

Setup a script to handle 403 errors by adding this line to your .htaccess:

ErrorDocument 403 /forbidden.php

然后在处理脚本中的重定向:

Then handle the redirect in the script:

<?php
header('Location: http://google.com');

还是要保持它的所有在.htaccess你可以这样做:

Or to keep it all in .htaccess you could do:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} 127.0.0.1
RewriteRule (.*) http://google.com [R]