重定向否认| htaccess的 [英] Redirect on deny | htaccess

查看:200
本文介绍了重定向否认| htaccess的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能得到,如果他们的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]

这篇关于重定向否认| htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆