如何重定向网址 [英] how to redirect a url

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

问题描述

大家好

如果现有网址在禁止使用的网址列表中,有什么方法可以将一个网址重定向到另一个网址?...
我正在用c ++.so编写代码,如果有人对它有任何想法..plz帮助....
我希望该代码适用于所有Web浏览器....这是关键因素..
假设我将URL地址写为"www.google.co.in".此URL已经是被阻止列表的列表.因此,根据我的应用程序,它将将此请求重定向到默认页面,请假设默认页面将是"www.codeproject.com" ...
请帮助我.....

hi all

is there any way by which i can redirect a url to another url,if the existing url is among the list of prohibted urls....
i am writing the code in c++.so if any body has any idea regarding it..plz help....
i wan the code to work for all web browser....that''s the key factor..
let suppose i write in the URL address as "www.google.co.in".and this URL is already i the list of blocked lists.so according to my application it will redirect this request to a default page,let suppose the default page would be"www.codeproject.com"...
plz help me.....

推荐答案

我想您已经具有该被阻止站点的列表,并且您正在编写用于阻止它们的代码并重定向到您的默认重定向站点..

这是标准防火墙的非常基本的功能...

对于阻止或允许浏览器请求的任何站点,您必须捕获这些请求并采取措施...而且我认为您已经为此编写了代码,它实际上是一个防火墙程序. (如果您在编写防火墙时遇到问题,请问我)

对于重定向,HTTP规范中有一个名为LOCATION的HEADER,您需要在响应中通过所需的重定向站点(例如"www.codeproject.com")设置此标头.

否则,您可以使用元重定向. (哪种方法更简单...)



< title>您的页面标题


此处为可选页面文字.
该站点已被阻止,您将重定向到codeproject.com




这里的5表示重定向之前要等待的秒数,同时您可以显示一条消息,指出此站点已被阻止,您将重定向到codeproject.com


祝你好运;-)
I guess you already have that list of blocked sites and you are writing code for block them and redirect to your default redirecting site..

It is a very basic functionality of a standard firewall...

Well for blocking or allowing any site requested from the browser you must capture those request and take action... and i think you already wrote the code for this, it is a firewall program actually. (If you are having problem in writing firewall then ask me)

For redirection there is a HEADER in HTTP specification called LOCATION you need to set this header by your desired redirecting site like "www.codeproject.com" in your response.

Otherwise you can use meta redirect. (Which is easier way...)



<title>Your Page Title


Optional page text here.
this site is blocked and you are redirection to codeproject.com




Here 5 indicates how many seconds you want to wait before redirect, meanwhile you can show a message that, this site is blocked and you are redirection to codeproject.com


Good Luck ;-)


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

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