如何重定向网址

编程入门 行业动态 更新时间:2024-10-18 05:57:55
本文介绍了如何重定向网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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"... plz help me.....

推荐答案

我想您已经具有该被阻止站点的列表,并且您正在编写用于阻止它们的代码并重定向到您的默认重定向站点.. 这是标准防火墙的非常基本的功能... 对于阻止或允许浏览器请求的任何站点,您必须捕获这些请求并采取措施...而且我认为您已经为此编写了代码,它实际上是一个防火墙程序. (如果您在编写防火墙时遇到问题,请问我) 对于重定向,HTTP规范中有一个名为LOCATION的HEADER,您需要在响应中通过所需的重定向站点(例如"www.codeproject")设置此标头. 否则,您可以使用元重定向. (哪种方法更简单...) < title>您的页面标题 此处为可选页面文字. 该站点已被阻止,您将重定向到codeproject 这里的5表示重定向之前要等待的秒数,同时您可以显示一条消息,指出此站点已被阻止,您将重定向到codeproject 祝你好运;-) 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" 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 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 Good Luck ;-)

更多推荐

如何重定向网址

本文发布于:2023-05-25 17:04:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/315139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   网址

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!