Thấy hay leech về cho mấy bạn chưa biết, cái này của anh PETER
1. Reditect theo referer: Tức là ta set
nếu request từ 1 domain cho trước thì redirect đến trang A, tất cả
request còn lại thì redirect tới trang B dựa vào script check referer
của PHP. Không biết bạn hình dung ra chưa nhưng xem đoạn script dưới đây
thì bạn sẽ nhận ra thôi
Code:
$referer=$_SERVER["HTTP_REFERER"];
$referer=parse_url($referer);
$referer=$referer['host'];
$referer=str_replace("www.","",$referer);
if ($referer=="hacker4a.net") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/web-tools/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
Với đoạn script trên thì mọi request từ domain hacker4a.net sẽ
được chuyển đến http://www.vncracking.com/web-tools/ và những
request bất kỳ còn lại sẽ được chuyển đến domain gốc http://www.vncracking.com
Redirect theo địa chỉ IP cho trước:
Trích dẫn:
Khi đó máy có IP là 210.245.120.84 sẽ được redirect sang http://www.yahoo.com/
còn tất cả IP còn lại sẽ được chuyển sang http://www.vncracking.com/
Tương tự với 2 địa chỉ IP cho trước:
Code:
$ip=$_SERVER["REMOTE_ADDR"];
if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.184") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.google.com/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
- IP mới thêm vào sẽ được chuyển sang http://www.google.com/
- Và nhiều hơn 2 IP thì ta cũng làm tương tự với elseif.
Lấy một trường hợp khác. Ta có 2 địa chỉ IP là: 210.245.120.84 và
230.162.5.18 khi truy cập vào trang web ta muốn máy có IP là
210.245.120.84 sẽ bị chuyển sang yahoo.com, máy có IP là 230.162.5.18 sẽ
bị pasword protect chặn lại còn tất cả máy khác thì được chuyển sang
vncracking.com. Ta làm như sau:
Code:
$ip=$_SERVER["REMOTE_ADDR"];
if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.18") {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="VNP Community"'); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
Mốt số mẫu khác :
- Lưu ý: Ở các mẫu bên dưới các bạn thay http://www.new-url.com
bằng url mà các bạn muốn redirect tới.
ColdFusion Redirect:
<.cfheader statuscode="301" statustext="Moved
permanently">
<.cfheader name="Location" value="http://www.new-url.com">
PHP Redirect:
Code:
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
ASP Redirect:
Code:
<%@ Language=VBscript %>
<%
Response.Status="301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com/");
%>
ASP .NET Redirect:
Code:
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
JSP (Java) Redirect:
Code:
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
%>
CGI PERL Redirect:
Code:
$q = new CGI;
print $q->redirect("http://www.new-url.com/");
Ruby on Rails Redirect:
Code:
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end
Htaccess Redirect:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
HTML Metatag Redirect: (Not 301 Redirect)
Code:
- x là số thời gian bạn muốn trang web chuẩn bị tự động di chuyển
tính bằng giây (sec).
Java-script Redirect: (Not 301 Redirect)
Code:
window.location.replace('http://www.new-url.com');
1. Reditect theo referer: Tức là ta set
nếu request từ 1 domain cho trước thì redirect đến trang A, tất cả
request còn lại thì redirect tới trang B dựa vào script check referer
của PHP. Không biết bạn hình dung ra chưa nhưng xem đoạn script dưới đây
thì bạn sẽ nhận ra thôi
Code:
$referer=$_SERVER["HTTP_REFERER"];
$referer=parse_url($referer);
$referer=$referer['host'];
$referer=str_replace("www.","",$referer);
if ($referer=="hacker4a.net") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/web-tools/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
Với đoạn script trên thì mọi request từ domain hacker4a.net sẽ
được chuyển đến http://www.vncracking.com/web-tools/ và những
request bất kỳ còn lại sẽ được chuyển đến domain gốc http://www.vncracking.com
Redirect theo địa chỉ IP cho trước:
Trích dẫn:
$ip=$_SERVER["REMOTE_ADDR"]; if ($ip=="210.245.120.84"){ Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://yahoo.com/" ); } else { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.vncracking.com/" ); } ?> |
Khi đó máy có IP là 210.245.120.84 sẽ được redirect sang http://www.yahoo.com/
còn tất cả IP còn lại sẽ được chuyển sang http://www.vncracking.com/
Tương tự với 2 địa chỉ IP cho trước:
Code:
$ip=$_SERVER["REMOTE_ADDR"];
if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.184") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.google.com/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
- IP mới thêm vào sẽ được chuyển sang http://www.google.com/
- Và nhiều hơn 2 IP thì ta cũng làm tương tự với elseif.
Lấy một trường hợp khác. Ta có 2 địa chỉ IP là: 210.245.120.84 và
230.162.5.18 khi truy cập vào trang web ta muốn máy có IP là
210.245.120.84 sẽ bị chuyển sang yahoo.com, máy có IP là 230.162.5.18 sẽ
bị pasword protect chặn lại còn tất cả máy khác thì được chuyển sang
vncracking.com. Ta làm như sau:
Code:
$ip=$_SERVER["REMOTE_ADDR"];
if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.18") {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="VNP Community"'); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
Mốt số mẫu khác :
- Lưu ý: Ở các mẫu bên dưới các bạn thay http://www.new-url.com
bằng url mà các bạn muốn redirect tới.
ColdFusion Redirect:
<.cfheader statuscode="301" statustext="Moved
permanently">
<.cfheader name="Location" value="http://www.new-url.com">
PHP Redirect:
Code:
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
ASP Redirect:
Code:
<%@ Language=VBscript %>
<%
Response.Status="301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com/");
%>
ASP .NET Redirect:
Code:
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
JSP (Java) Redirect:
Code:
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
%>
CGI PERL Redirect:
Code:
$q = new CGI;
print $q->redirect("http://www.new-url.com/");
Ruby on Rails Redirect:
Code:
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end
Htaccess Redirect:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
HTML Metatag Redirect: (Not 301 Redirect)
Code:
- x là số thời gian bạn muốn trang web chuẩn bị tự động di chuyển
tính bằng giây (sec).
Java-script Redirect: (Not 301 Redirect)
Code: