[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN109302437A - A kind of method and apparatus redirecting website - Google Patents

A kind of method and apparatus redirecting website Download PDF

Info

Publication number
CN109302437A
CN109302437A CN201710613289.8A CN201710613289A CN109302437A CN 109302437 A CN109302437 A CN 109302437A CN 201710613289 A CN201710613289 A CN 201710613289A CN 109302437 A CN109302437 A CN 109302437A
Authority
CN
China
Prior art keywords
address
website
terminal
domain name
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710613289.8A
Other languages
Chinese (zh)
Other versions
CN109302437B (en
Inventor
金磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Ezviz Network Co Ltd
Original Assignee
Hangzhou Ezviz Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Ezviz Network Co Ltd filed Critical Hangzhou Ezviz Network Co Ltd
Priority to CN201710613289.8A priority Critical patent/CN109302437B/en
Publication of CN109302437A publication Critical patent/CN109302437A/en
Application granted granted Critical
Publication of CN109302437B publication Critical patent/CN109302437B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/563Data redirection of data network streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention provides a kind of method and apparatus for redirecting website, belong to network technique field.The described method includes: receiving the DNS query request that terminal is sent, wherein, the domain name of website to be visited is carried in the DNS query request, if meeting preset website redirects condition, then preset IP address is sent to the terminal, when receiving the webpage acquisition request that the terminal is sent, if the IP address carried in the webpage acquisition request is the preset IP address, then obtain the pre-stored address for redirecting website, redirection message is sent to the terminal, wherein, the address for redirecting website is carried in the redirection message, so as to redirect website described in the terminal access.Using the present invention, the method for providing other device redirection websites and deferring to http agreement.

Description

A kind of method and apparatus redirecting website
Technical field
The present invention relates to network technique field, in particular to a kind of method and apparatus for redirecting website.
Background technique
In the prior art, the method for redirecting website is usually that server receives the webpage acquisition request of terminal transmission Afterwards, redirection message is sent to terminal, and in the address for the website for wherein carrying redirection, terminal can be based on redirection website Address, access the website of redirection.
In this way, the method for only proposing server redirection website in the prior art, there is no propose on other equipment (such as roads By equipment) on redirect website and the method for deferring to http agreement.
Summary of the invention
In order to solve the problems, such as that user experience is poor, the embodiment of the invention provides it is a kind of redirect website method and Device.The technical solution is as follows:
In a first aspect, providing a kind of method for redirecting website, which comprises
Receive the DNS query request that terminal is sent, wherein the domain of website to be visited is carried in the DNS query request Name;
If meeting preset website redirects condition, preset IP address is sent to the terminal;
When receiving the webpage acquisition request that the terminal is sent, if the IP carried in the webpage acquisition request Location is the preset IP address, then obtains the pre-stored address for redirecting website;
Redirection message is sent to the terminal, wherein the redirection website is carried in the redirection message Address, so as to redirect website described in the terminal access.
Optionally, the address for redirecting website is domain name and IP address.
Optionally, if the domain name of the website to be visited meets preset website and redirects condition, to described Terminal sends preset IP address, comprising:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
Optionally, if the domain name of the website to be visited meets preset website and redirects condition, to described Terminal sends preset IP address, comprising:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the website to be visited Domain name then sends preset IP address to the terminal;
If the IP address carried in the webpage acquisition request is the preset IP address, acquisition is deposited in advance The address of the redirection website of storage, comprising:
If the IP address carried in the webpage acquisition request is the preset IP address, it is stored in advance described New domain name and old domain name corresponding relationship in, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection The address of website.
Optionally, after the preset IP address to terminal transmission, further includes:
TCP connection is established based on the preset IP address and the terminal.
Second aspect, provides a kind of device for redirecting website, and described device includes:
Receiving module, for receiving the DNS query request of terminal transmission, wherein carried in DNS query request to Access the domain name of website;
Sending module, if redirecting condition for meeting preset website, with sending preset IP to the terminal Location;
Module is obtained, for being asked if the webpage obtains when receiving the webpage acquisition request that the terminal is sent The IP address for asking middle carrying is the preset IP address, then obtains the pre-stored address for redirecting website;
The sending module, for sending redirection message to the terminal, wherein carried in the redirection message The address for redirecting website, so as to redirect website described in the terminal access.
Optionally, the address for redirecting website is domain name and IP address.
Optionally, the sending module, is used for:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
Optionally, the sending module, is used for:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the website to be visited Domain name then sends preset IP address to the terminal;
The acquisition module, is used for:
If the IP address carried in the webpage acquisition request is the preset IP address, it is stored in advance described New domain name and old domain name corresponding relationship in, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection The address of website.
Optionally, described device further include:
Link block, for establishing TCP connection based on the preset IP address and the terminal.
The third aspect provides a kind of device for redirecting website, and described device includes processor, memory, in which:
The memory, for storing computer program;
The processor when for executing the program stored on memory, realizes the redirection net of above-mentioned first aspect The method stood.
Technical solution provided in an embodiment of the present invention has the benefit that
In the embodiment of the present invention, router receives the DNS query request that terminal is sent, and resets if meeting preset website To condition, then preset IP address is sent to terminal, when receiving the webpage acquisition request of terminal transmission, if webpage obtains The IP address carried in request is preset IP address, then obtains the pre-stored address for redirecting website, send to terminal Redirection message, in this way, router can execute the processing for redirecting website, and complete in the treatment process for redirecting website Http agreement is deferred to entirely, thus the method for proposing other device redirection websites and deferring to http agreement.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is a kind of flow diagram of method for redirecting website provided in an embodiment of the present invention;
Fig. 2 is a kind of flow diagram of method for redirecting website provided in an embodiment of the present invention;
Fig. 3 is a kind of flow diagram of method for redirecting website provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of device for redirecting website provided in an embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram of device for redirecting website provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram of equipment provided in an embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
The embodiment of the invention provides a kind of method for redirecting website, the executing subject of this method can be terminal connection The network equipment, such as router, repeater, interchanger, terminal can be mobile phone, tablet computer, computer etc..Wherein, the net Processor, memory and transceiver etc. can be set in network equipment, processor can be used for redirecting the processing of website process, Memory can be used for redirecting the data of the data and generation that need during website, transceiver can be used for receiving and Send message etc..In the present embodiment by taking the network equipment is router as an example, carry out the detailed description of scheme, other situations with etc Seemingly, the present embodiment is not repeated.
As shown in Figure 1, the process flow of this method may include following step:
Step 101, terminal receives the domain name of the website to be visited of user's input, sends DNS query request to router.
In an implementation, user want using terminal on the net access some websites, the browser for the middle installation that can open a terminal, Terminal can show the main interface of browser, and network address input frame and corresponding search option are shown in main interface.User can To input the network address for the website to be accessed in network address input frame, network address herein refers to domain name, and then user can click search Option, terminal can then receive the click commands of search option, Main Domain in the network address of the available user's input of terminal (after The continuous domain name for being properly termed as website to be visited), if network address is www.taotao.com/u/1234.htm, Main Domain is www.taotao.com.Then to router transmission DNS (Domain Name System, domain name system) inquiry request, and The domain name of website to be visited is carried in DNS query request.
It should be noted that after user opens browser, network address input frame is aobvious if terminal mentioned above is computer At the position for showing the network address of current interface.If terminal mentioned above is mobile phone, after user opens browser, network address input frame As search for input frame.
Step 102, router receives the DNS query request that terminal is sent, wherein carries in DNS query request wait visit Ask the domain name of website.
Step 103, if meeting preset website redirects condition, router sends preset IP address to terminal.
Wherein, the address preset IP (Internet Protocol, network between interconnection agreement) can be set by technical staff It sets, and stores into router, such as 1.125.125.254.Preset website redirects condition can also be by technical staff Setting, and store into router, such as router does not access network.
In an implementation, technical staff is provided with kernel hooking function in the router, and kernel hooking function can be added to In thread for executing message forwarding, for being intercepted to the message received, and identified.When router receives When the DNS query request that terminal is sent, kernel hooking function can request to intercept to DNS query, and identify in message Content.If meeting preset website redirects condition, then available preset IP address sends preset IP to terminal Address.
It should be noted that execute herein, message is intercepted and the function of identification is kernel hooking function, all to can be used for It executes the function that message is intercepted and identified and is suitable for the embodiment of the present invention, the embodiment of the present invention is without limitation.
Step 104, the preset IP address that terminal receiving router is sent sends webpage acquisition request to router.
In an implementation, after terminal receives the preset IP address that router is sent, webpage can be sent to router and obtained Request is taken, which can be http service request, wherein carrying preset IP address and GET (acquisition) mark.
Step 105, when receiving the webpage acquisition request of terminal transmission, if the IP carried in webpage acquisition request Location is preset IP address, then router obtains the pre-stored address for redirecting website.
Wherein, the address for redirecting website can be stored in advance into router.
In an implementation, after router receives the webpage acquisition request of terminal transmission, kernel hooking function in router The thread at place can intercept the webpage acquisition request, and be identified, if the IP address wherein carried is default IP address, router it is available it is pre-stored redirect website network address.
In addition, can further judge webpage if the IP address carried in webpage acquisition request is preset IP address Identifying whether in acquisition request is GET mark, is indicated if it is GET, the available pre-stored ground for redirecting website Location.
Optionally, the address for redirecting website is domain name and IP address.
Step 106, router sends redirection message to terminal, wherein carries in redirection message and redirects website Address.
Wherein, redirection message is http302 redirection message.
In an implementation, after router gets the address for redirecting website, redirection message can be sent to terminal, in weight The address for redirecting website is carried in orientation message.For example, the address for redirecting website is IP address 10.10.10.10, weight Orientation message can be such that
“HTTP/1.1 302Moved Temporarily\r\n"
"Server:boa 1.1\r\n"
"Date:Sat,21Dec 2009 12:00:00GMT\r\n"
"Connection:close\r\n"
"cache-Control:no-cache\r\n"
"Content-Type:text/html\r\n"
"Location:10.10.10.10\r\n"
"<html><body><br><br></body></html>\r\n”
Step 107, terminal receives redirection message, accesses the address of the redirection website carried in redirection message.
In an implementation, after terminal receives the redirection message that router is sent, it can be used in redirection message and carry Redirection website address, access redirects website, and detailed process describes in detail below.
As shown in Fig. 2, the embodiment of the present invention is held if it is that router does not access network that preset website, which redirects condition, Row process can be such that
Step 201, terminal receives the domain name of the website to be visited of user's input, sends DNS query request to router.
Identical as the treatment process of step 101, details are not described herein again.
Step 202, router receives the DNS query request that terminal is sent, wherein carries in DNS query request wait visit Ask the domain name of website.
Identical as the treatment process of step 102, details are not described herein again.
Step 203, if detecting that this equipment does not access network, preset IP address is sent to terminal.
Wherein, preset IP address can be arranged by technical staff, and store into router, such as 1.125.125.254 waiting.
In an implementation, technical staff is provided with kernel hooking function in the router, and kernel hooking function can be added to In thread for executing message forwarding, for being intercepted to the message received, and identified.When router receives When the DNS query request that terminal is sent, kernel hooking function can request to intercept to DNS query, and identify in message Content.If detecting that this equipment can not request to be forwarded to the DNS query, determines that this equipment does not access network, can obtain Preset IP address is taken, then sends preset IP address to terminal.Terminal receives the preset IP address of router transmission Afterwards, webpage acquisition request can be sent to router, which can be http service request, wherein carrying default IP address and GET (acquisition) mark.
It should be noted that execute herein, message is intercepted and the function of identification is kernel hooking function, all to can be used for It executes the function that message is intercepted and identified and is suitable for the embodiment of the present invention, the embodiment of the present invention is without limitation.
Step 204, the preset IP address that terminal receiving router is sent.
Identical as the processing of step 104, details are not described herein again.
Step 205, router is based on preset IP address and terminal establishes TCP connection, and terminal sends webpage to router Acquisition request.
In an implementation, it after terminal receives the preset IP address that router is sent, can be set to preset IP is corresponding Preparation plays TCP (Transmission Control Protocol, transmission control protocol) connection, specifically can be to router It sends TCP SYN (Synchronize, synchronous) message and determines IP after router receives the TCP SYN message of terminal transmission Address is preset IP address, TCP SYN+ACK (acknowledgement confirms character) message can be sent to terminal, eventually After termination receives the TCP SYN+ACK message of router transmission, TCP ACK message can be sent to router, then to routing Device sends webpage acquisition request, which can be http service request, wherein carrying preset IP address and GET (acquisition) mark.
Step 206, when receiving the webpage acquisition request of terminal transmission, if the IP carried in webpage acquisition request Location is preset IP address, then router obtains the pre-stored address for redirecting website.
In an implementation, after router receives the webpage acquisition request of terminal transmission, kernel hooking function in router The thread at place can intercept the webpage acquisition request, and be identified, if the IP address wherein carried is default IP address, router it is available it is pre-stored redirect website network address, this it is pre-stored redirect website net Location is the network address for being connected to the network interface, can be domain name or IP address.
Step 207, router sends redirection message to terminal, wherein carries in redirection message and redirects website Address.
Wherein, corresponding network connection circle of network address at network connection interface has been stored in advance in technical staff in the router Face.
In an implementation, the process that router sends redirection message to terminal is identical as the processing of step 104, herein no longer It repeats.
Step 208, terminal receives redirection message, accesses the address of the redirection website carried in redirection message.
In an implementation, after terminal receives the redirection message that router is sent, available redirection website therein Address, if the address for redirecting website is IP address, terminal can establish TCP connection to the corresponding equipment of the IP address (identical with the processing of step 203), then sends webpage acquisition request to router, and router receives webpage acquisition request Afterwards, the corresponding network connection interface of the network address carried in the webpage acquisition request can be searched, then network is sent to terminal and connects Border face, terminal can receive and show network connection interface, and user can input account and password is attached operation.If The address for redirecting website is domain name, which is to be connected to the network the domain name at interface, and terminal can send DNS query to router Request, in the domain name for wherein carrying network connection interface, after router receives the DNS query request of terminal transmission, router In kernel hooking function where thread can identify DNS query request, if domain name therein be network connection interface pair The domain name answered, can to the corresponding IP address of terminal feedback network linkage interface, after the IP address that terminal receiving router is sent, Can equipment corresponding with the IP address establish TCP connection (and the processing of step 203 is identical).Then webpage is sent to router After router receives webpage acquisition request, it is corresponding can to search the network address carried in the webpage acquisition request for acquisition request It is connected to the network interface, then sends network connection interface to terminal, terminal can receive and show network connection interface, Yong Huke Operation is attached to input account and password.
It should be noted that due in step 208 IP address be connected to the network interface network address, network connection interface storage In the router, so the IP address is the IP address of router, corresponding equipment is router.
In this way, terminal sends DNS query request in the case where router does not access network, can receive default IP address, rather than show that webpage obtains the notice of failure, and terminal can also use preset IP address and router TCP connection is established, then router just sends the network address at network connection interface to terminal, in no change terminal implementation procedure In the case of, webpage is redirected on webpage linkage interface, router can be accessed network by user.It follows that not having Webpage is realized on the basis of change http agreement to jump.
As shown in figure 3, it is in pre-stored new domain name and the corresponding relationship of old domain name that preset website, which redirects condition, Old domain name include website to be visited domain name, the execution process of the embodiment of the present invention can be such that
Step 301, terminal receives the domain name of the website to be visited of user's input, sends DNS query request to router.
Identical as the treatment process of step 101, details are not described herein again.
Step 302, router receives the DNS query request that terminal is sent, wherein carries in DNS query request wait visit Ask the domain name of website.
Identical as the treatment process of step 102, details are not described herein again.
Step 303, if the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes net to be visited The domain name stood then sends preset IP address to terminal.
In an implementation, the corresponding relationship of new domain name Yu old domain name has been stored in advance in technical staff in the router, right at this It should be related to that middle new domain name belongs to two domain names of same website with corresponding old domain name.Alternatively, router can be when default The long new domain name that website is crawled from network and old domain name, if router accesses the bulletin of each website every other week, therefrom Determine whether to change domain name, it then will be in the new domain name corresponding relationship for being added to new domain name and old domain name corresponding with old domain name.
After router receives the DNS query request of terminal transmission, the thread in router where kernel hooking function can To identify the domain name of website to be visited wherein carried, if the old domain name in new domain name and the corresponding relationship of old domain name include to The domain name of website is accessed, the available preset IP address of router sends preset IP address to terminal.
Step 304, the preset IP address that terminal receiving router is sent.
Identical as the processing of step 104, details are not described herein again.
Step 305, router is based on preset IP address and terminal establishes TCP connection, and terminal sends webpage to router Acquisition request.
In an implementation, it after terminal receives the preset IP address that router is sent, can be set to preset IP is corresponding Preparation plays TCP connection, specifically can be to router and sends TCP SYN message, and router receives the TCP SYN of terminal transmission It after message, determines that IP address is preset IP address, TCP SYN+ACK message can be sent to terminal, terminal receives routing After the TCP SYN+ACK message that device is sent, TCP ACK message can be sent to router, then send webpage to router and obtain Request is taken, which can be http service request, wherein carrying preset IP address and GET (acquisition) mark.
Step 306, if the IP address carried in webpage acquisition request is preset IP address, pre-stored new In the corresponding relationship of domain name and old domain name, the corresponding new domain name of domain name of website to be visited is obtained, as the ground for redirecting website Location.
In an implementation, after router receives the webpage acquisition request that terminal is sent, kernel hooking function institute in router Thread the webpage acquisition request can be intercepted, and identified, if the IP address wherein carried is preset IP address can determine the corresponding new domain name of the domain name of website to be visited, by this in new domain name and the corresponding relationship of old domain name New domain name is as the address for redirecting website.
Optionally, the corresponding relationship of new domain name and IP address is cached in router, router determines website to be visited After the corresponding new domain name of domain name, the corresponding IP address of new domain name can be determined in new domain name and the corresponding relationship of IP address, it will The IP address is as the address for redirecting website.
Step 307, router sends redirection message to terminal, wherein carries in redirection message and redirects website Address so that terminal access redirect website.
In an implementation, the process that router sends redirection message to terminal is identical as the processing of step 104, herein no longer It repeats.
Step 308, terminal receives redirection message, accesses the address of the redirection website carried in redirection message.
In an implementation, after terminal receives the redirection message that router is sent, available redirection website therein Address, if the address for redirecting website is IP address, terminal can establish TCP connection to equipment belonging to the IP address (identical with the processing of step 203) then sends webpage acquisition request to router, carries the IP address, router wherein After receiving webpage acquisition request, webpage acquisition request can be forwarded to belonging to the IP address carried in webpage acquisition request Equipment, the equipment send the corresponding webpage of the IP address to terminal.If the address for redirecting website is domain name, terminal can be to Router sends DNS query request, wherein carry the domain name, after router receives DNS query request, determines new domain name and old Old domain name in the corresponding relationship of domain name does not include the domain name, and DNS query request, domain name service can be forwarded to name server Device can inquire the corresponding IP address of the domain name, then send the IP address to terminal, and terminal receives name server transmission IP address after, TCP connection (and the processing of step 203 is identical) can be established with equipment belonging to the IP address then to routing Device sends webpage acquisition request, carries the IP address wherein, after router receives webpage acquisition request, webpage can be obtained Request is taken to be forwarded to equipment belonging to the IP address carried in webpage acquisition request, which sends the IP address to terminal and correspond to Webpage.
In this way, when user's operation terminal uses old domain name access some websites, due to not stored old in name server Domain name or name server break down, and terminal cannot then access the website, and in embodiments of the present invention, terminal sends DNS Inquiry request can receive preset IP address, rather than show that webpage obtains the notice of failure, and terminal can also make TCP connection is established with preset IP address and router, then router just sends the network address for redirecting website to terminal, is not having In the case where having the implementation procedure for changing terminal, website is redirected to and is redirected on website, the accessible redirection of terminal Website both realizes and redirects website, the domain name shown in browser can also be made corresponding with the website of display, will not be changed Http agreement.
In the embodiment of the present invention, router receives the DNS query request that terminal is sent, and resets if meeting preset website To condition, then preset IP address is sent to terminal, when receiving the webpage acquisition request of terminal transmission, if webpage obtains The IP address carried in request is preset IP address, then obtains the pre-stored address for redirecting website, send to terminal Redirection message, in this way, router can execute the processing for redirecting website, and complete in the treatment process for redirecting website Http agreement is deferred to entirely, thus the method for proposing other device redirection websites and deferring to http agreement.
Based on the same technical idea, the embodiment of the invention also provides a kind of devices for redirecting website, such as Fig. 4 institute Show, which includes:
Receiving module 410, for receiving the DNS query request of terminal transmission, wherein carried in the DNS query request There is the domain name of website to be visited;
Sending module 420 sends preset IP to the terminal if redirecting condition for meeting preset website Address;
Module 430 is obtained, for when receiving the webpage acquisition request that the terminal is sent, if the webpage obtains The IP address carried in request is the preset IP address, then obtains the pre-stored address for redirecting website;
The sending module 420, for sending redirection message to the terminal, wherein taken in the redirection message With the address for redirecting website, so as to redirect website described in the terminal access.
Optionally, the address for redirecting website is domain name and IP address.
Optionally, the sending module 420, is used for:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
Optionally, the sending module 420, is used for:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the website to be visited Domain name then sends preset IP address to the terminal;
The acquisition module 430, is used for:
If the IP address carried in the webpage acquisition request is the preset IP address, it is stored in advance described New domain name and old domain name corresponding relationship in, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection The address of website.
Optionally, as shown in figure 5, described device further include:
Link block 440, for establishing TCP connection based on the preset IP address and the terminal.
In the embodiment of the present invention, router receives the DNS query request that terminal is sent, and resets if meeting preset website To condition, then preset IP address is sent to terminal, when receiving the webpage acquisition request of terminal transmission, if webpage obtains The IP address carried in request is preset IP address, then obtains the pre-stored address for redirecting website, send to terminal Redirection message, in this way, router can execute the processing for redirecting website, and since router is receiving terminal transmission DNS query request after, preset IP address can be sent to terminal, also violate http agreement.To propose other equipment weights Orientation website and the method for deferring to http agreement.
It should be understood that it is provided by the above embodiment redirect website device when redirecting website, only with above-mentioned The division progress of each functional module can according to need and for example, in practical application by above-mentioned function distribution by different Functional module is completed, i.e., the internal structure of device is divided into different functional modules, with complete it is described above whole or Partial function.In addition, the embodiment of the method for the device provided by the above embodiment for redirecting website and redirection website belongs to together One design, specific implementation process are detailed in embodiment of the method, and which is not described herein again.
Referring to FIG. 6, the equipment can be used for it illustrates the structural schematic diagram of equipment involved in the embodiment of the present invention The method of redirection website provided in above-described embodiment is provided.Specifically:
Equipment 600 may include RF (Radio Frequency, radio frequency) circuit 110, include one or more meter The components such as the memory 120 of calculation machine readable storage medium storing program for executing, the processor 130 for including one or more than one processing core. It will be understood by those skilled in the art that device structure shown in Fig. 6 does not constitute the restriction to equipment, it may include than diagram More or fewer components perhaps combine certain components or different component layouts.Wherein:
RF circuit 110 can be used for receiving and sending messages, and signal sends and receivees, and memory 120 can be used for storing software program And module, processor 130 is stored in the software program and module of memory 120 by operation, thereby executing various functions Using and data processing.Memory 120 can mainly include storing program area and storage data area, wherein storing program area can Application program needed for storage program area, at least one function (such as sound-playing function, image player function etc.) etc.;It deposits Storage data field, which can be stored, uses created data etc. according to equipment 600.In addition, memory 120 may include that high speed is random Access memory, can also include nonvolatile memory, a for example, at least disk memory, flush memory device or other Volatile solid-state part.Correspondingly, memory 120 can also include Memory Controller, to provide processor 130 to depositing The access of reservoir 120.
Processor 130 is the control centre of equipment 600, utilizes each portion of various interfaces and connection whole equipment Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120 Interior data execute the various functions and processing data of equipment 600, to carry out integral monitoring to mobile phone.Optionally, processor 130 may include one or more processing cores.
Equipment 600 further includes having the perhaps more than one program one of them or more than one of memory and one Program is stored in memory, and is configured to state one or more than one journey by one or the execution of more than one processor Sequence includes the instruction for performing the following operation:
Receive the DNS query request that terminal is sent, wherein the domain of website to be visited is carried in the DNS query request Name;
If meeting preset website redirects condition, preset IP address is sent to the terminal;
When receiving the webpage acquisition request that the terminal is sent, if the IP carried in the webpage acquisition request Location is the preset IP address, then obtains the pre-stored address for redirecting website;
Redirection message is sent to the terminal, wherein the redirection website is carried in the redirection message Address, so as to redirect website described in the terminal access.
Optionally, the address for redirecting website is domain name and IP address.
Optionally, if the domain name of the website to be visited meets preset website and redirects condition, to described Terminal sends preset IP address, comprising:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
Optionally, if the domain name of the website to be visited meets preset website and redirects condition, to described Terminal sends preset IP address, comprising:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the website to be visited Domain name then sends preset IP address to the terminal;
If the IP address carried in the webpage acquisition request is the preset IP address, acquisition is deposited in advance The address of the redirection website of storage, comprising:
If the IP address carried in the webpage acquisition request is the preset IP address, it is stored in advance described New domain name and old domain name corresponding relationship in, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection The address of website.
Optionally, after the preset IP address to terminal transmission, further includes:
TCP connection is established based on the preset IP address and the terminal.
In the embodiment of the present invention, router receives the DNS query request that terminal is sent, and resets if meeting preset website To condition, then preset IP address is sent to terminal, when receiving the webpage acquisition request of terminal transmission, if webpage obtains The IP address carried in request is preset IP address, then obtains the pre-stored address for redirecting website, send to terminal Redirection message, in this way, router can execute the processing for redirecting website, and complete in the treatment process for redirecting website Http agreement is deferred to entirely, thus the method for proposing other device redirection websites and deferring to http agreement.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (11)

1. a kind of method for redirecting website, which is characterized in that the described method includes:
Receive the domain name system DNS inquiry request that terminal is sent, wherein carry website to be visited in the DNS query request Domain name;
If meeting preset website redirects condition, preset IP address is sent to the terminal;
When receiving the webpage acquisition request that the terminal is sent, if the IP address carried in the webpage acquisition request is The preset IP address then obtains the pre-stored address for redirecting website;
Redirection message is sent to the terminal, wherein the address for redirecting website is carried in the redirection message, So as to redirect website described in the terminal access.
2. the method according to claim 1, wherein the address for redirecting website is domain name and IP address.
3. if the method according to claim 1, wherein the domain name satisfaction of the website to be visited is default Website redirect condition, then send preset IP address to the terminal, comprising:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
4. if the method according to claim 1, wherein the domain name satisfaction of the website to be visited is default Website redirect condition, then send preset IP address to the terminal, comprising:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the domain name of the website to be visited, Then preset IP address is sent to the terminal;
If the IP address carried in the webpage acquisition request is the preset IP address, obtain pre-stored Redirect the address of website, comprising:
If the IP address carried in the webpage acquisition request is the preset IP address, described pre-stored new In the corresponding relationship of domain name and old domain name, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection website Address.
5. the method according to claim 3 or 4, which is characterized in that it is described to the terminal send preset IP address it Afterwards, further includes:
TCP connection is established based on the preset IP address and the terminal.
6. a kind of device for redirecting website, which is characterized in that described device includes:
Receiving module, for receiving the domain name system DNS inquiry request of terminal transmission, wherein carried in the DNS query request There is the domain name of website to be visited;
Sending module sends preset IP address to the terminal if redirecting condition for meeting preset website;
Module is obtained, for when receiving the webpage acquisition request that the terminal is sent, if in the webpage acquisition request The IP address of carrying is the preset IP address, then obtains the pre-stored address for redirecting website;
The sending module, for sending redirection message to the terminal, wherein carried in the redirection message described The address for redirecting website, so as to redirect website described in the terminal access.
7. device according to claim 6, which is characterized in that the address for redirecting website is domain name and IP address.
8. device according to claim 6, which is characterized in that the sending module is used for:
If detecting that this equipment does not access network, preset IP address is sent to the terminal.
9. device according to claim 6, which is characterized in that the sending module is used for:
If the old domain name in pre-stored new domain name and the corresponding relationship of old domain name includes the domain name of the website to be visited, Then preset IP address is sent to the terminal;
The acquisition module, is used for:
If the IP address carried in the webpage acquisition request is the preset IP address, described pre-stored new In the corresponding relationship of domain name and old domain name, the corresponding new domain name of domain name of the website to be visited is obtained, as redirection website Address.
10. device according to claim 8 or claim 9, which is characterized in that described device further include:
Link block, for establishing TCP connection based on the preset IP address and the terminal.
11. a kind of device for redirecting website, which is characterized in that including processor, memory, in which:
The memory, for storing computer program;
The processor when for executing the program stored on memory, realizes any method step of claim 1-5 Suddenly.
CN201710613289.8A 2017-07-25 2017-07-25 Method and device for redirecting website Active CN109302437B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710613289.8A CN109302437B (en) 2017-07-25 2017-07-25 Method and device for redirecting website

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710613289.8A CN109302437B (en) 2017-07-25 2017-07-25 Method and device for redirecting website

Publications (2)

Publication Number Publication Date
CN109302437A true CN109302437A (en) 2019-02-01
CN109302437B CN109302437B (en) 2022-01-11

Family

ID=65167346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710613289.8A Active CN109302437B (en) 2017-07-25 2017-07-25 Method and device for redirecting website

Country Status (1)

Country Link
CN (1) CN109302437B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110719169A (en) * 2019-11-07 2020-01-21 北京小米移动软件有限公司 Method and device for transmitting router safety information
CN110933129A (en) * 2019-10-18 2020-03-27 网宿科技股份有限公司 Data scheduling method, plug-in, device and scheduling server
CN111953761A (en) * 2020-08-04 2020-11-17 Oppo广东移动通信有限公司 Data processing method and device, electronic equipment and storage medium
CN113194065A (en) * 2021-03-17 2021-07-30 广州根链国际网络研究院有限公司 DNS attack protection method and system
CN114154099A (en) * 2021-12-07 2022-03-08 北京达佳互联信息技术有限公司 Routing information processing method, device, equipment and storage medium
CN114745434A (en) * 2022-04-06 2022-07-12 北京三快在线科技有限公司 Method, device, equipment and storage medium for proxy network request

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103780654A (en) * 2012-10-24 2014-05-07 华为技术有限公司 Business request processing method, user terminal, business router and network system
CN104010051A (en) * 2014-06-05 2014-08-27 胡汉强 Network access method, network access device and management server
CN104243627A (en) * 2014-08-29 2014-12-24 华为技术有限公司 Domain name resolution method, device and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103780654A (en) * 2012-10-24 2014-05-07 华为技术有限公司 Business request processing method, user terminal, business router and network system
CN104010051A (en) * 2014-06-05 2014-08-27 胡汉强 Network access method, network access device and management server
CN104243627A (en) * 2014-08-29 2014-12-24 华为技术有限公司 Domain name resolution method, device and system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110933129A (en) * 2019-10-18 2020-03-27 网宿科技股份有限公司 Data scheduling method, plug-in, device and scheduling server
CN110719169A (en) * 2019-11-07 2020-01-21 北京小米移动软件有限公司 Method and device for transmitting router safety information
US11316838B2 (en) 2019-11-07 2022-04-26 Beijing Xiaomi Mobile Software Co., Ltd. Method and apparatus for transmitting router security information
CN111953761A (en) * 2020-08-04 2020-11-17 Oppo广东移动通信有限公司 Data processing method and device, electronic equipment and storage medium
CN111953761B (en) * 2020-08-04 2023-07-25 Oppo广东移动通信有限公司 Data processing method, device, electronic equipment and storage medium
CN113194065A (en) * 2021-03-17 2021-07-30 广州根链国际网络研究院有限公司 DNS attack protection method and system
CN114154099A (en) * 2021-12-07 2022-03-08 北京达佳互联信息技术有限公司 Routing information processing method, device, equipment and storage medium
CN114745434A (en) * 2022-04-06 2022-07-12 北京三快在线科技有限公司 Method, device, equipment and storage medium for proxy network request

Also Published As

Publication number Publication date
CN109302437B (en) 2022-01-11

Similar Documents

Publication Publication Date Title
CN109302437A (en) A kind of method and apparatus redirecting website
CN109803336B (en) Session establishment method and device
EP3595355A1 (en) Resource obtaining method, apparatus and system
CN104333567B (en) It is the web cachings serviced using safety
CN109922053A (en) Data transmission method, device, electronic equipment and readable storage medium storing program for executing
CN110098947A (en) A kind of dispositions method of application, equipment and system
CN107105071A (en) IP call methods and device, storage medium, electronic equipment
CN106797391A (en) Use service layer&#39;s interworking of MQTT agreements
CN107925681A (en) The system and method that the load balance in network packet core system is defined for distributed software
EP3422672B1 (en) Routing method and device
CN107517189B (en) Method and equipment for WLAN user access authentication and configuration information issuing
CN108270882A (en) The analysis method and device of domain name, storage medium, electronic device
CN109587254A (en) Cloud Server access method, device, Cloud Server and storage medium
CN107181779A (en) Processing method, the device and system of access request
US20230079314A1 (en) Service server switching control method and apparatus, electronic device, and storage medium
US11638138B2 (en) Device-to-device content providing method
US20050108574A1 (en) Method and system for communication between a multi-modal device and a web application
CN101730999A (en) System and method for sharing common location-related information between communication devices
US20180048729A1 (en) Methods and Systems for Handling Requests Regarding Zero-Rating
CN110049503A (en) A kind of method and apparatus obtaining data
US10382305B2 (en) Applying sequenced instructions to connect through captive portals
CN109474710A (en) Obtain the method and device of information
JP2012085299A (en) Remote downloading method, system, and persistent computer readable storage medium
CN108989420A (en) The method and system of registration service, the method and system for calling service
CN112969208B (en) Service server switching control method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: No. 555, Qianmo Road, Binjiang District, Hangzhou, Zhejiang 310000

Applicant after: Hangzhou fluorite Network Co.,Ltd.

Address before: No. 555, Qianmo Road, Binjiang District, Hangzhou, Zhejiang 310000

Applicant before: HANGZHOU EZVIZ NETWORK Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant