CN104065736A - URL redirection method, device, and system - Google Patents

URL redirection method, device, and system Download PDF

Info

Publication number
CN104065736A
CN104065736A CN201410314533.7A CN201410314533A CN104065736A CN 104065736 A CN104065736 A CN 104065736A CN 201410314533 A CN201410314533 A CN 201410314533A CN 104065736 A CN104065736 A CN 104065736A
Authority
CN
China
Prior art keywords
redirected
url
data dictionary
class catalogue
rule
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
CN201410314533.7A
Other languages
Chinese (zh)
Other versions
CN104065736B (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.)
Che Zhi Interconnect (beijing) Technology Co Ltd
Original Assignee
Che Zhi Interconnect (beijing) Technology 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 Che Zhi Interconnect (beijing) Technology Co Ltd filed Critical Che Zhi Interconnect (beijing) Technology Co Ltd
Priority to CN201410314533.7A priority Critical patent/CN104065736B/en
Publication of CN104065736A publication Critical patent/CN104065736A/en
Application granted granted Critical
Publication of CN104065736B publication Critical patent/CN104065736B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The utility model discloses a URL redirection method, a device, and a system. The method comprises the steps: acquiring a URL demanded by a client; acquiring a first-stage catalogue of a demand path from the URL; looking up a redirection rule set correlative with the first-stage catalogue from a data dictionary according to the acquired first-stage catalogue, wherein the data dictionary comprises one or more data items, and each data item comprises an item name and a relevant redirection rule set; carrying out regular matching of the demand path in a demanded URL with the founded redirection rule set; and carrying out redirection for the URL according to a matched redirection rule. According to the invention, the processing speed of URL redirection of a server side is improved, thereby improving the client speed of visiting a resource in a server.

Description

A kind of URL reorientation method, Apparatus and system
Technical field
The present invention relates to internet arena, be specifically related to a kind of URL reorientation method, Apparatus and system.
Background technology
URL (Uniform Resource Locator, URL(uniform resource locator)) is the resource address of standard on internet, for intactly describing webpage and other resources on internet.URL is comprised of a series of characters, and form is protocol: // [username:password] host[/path] [? query].Wherein, protocol territory given transmission agreement; Username and password territory are specified and are connected to the required username and password of server; Host name or the IP address of the server of depositing resource specified in host territory; The store path of resource in the given host of path territory; Query territory is assigned to the parameter that dynamic web page transmits.During the information resources of client-requested access services device, need agreement, the server of request, the information such as the store path of request resource (being referred to as request path in the present invention) of determining that request is used, above-mentioned information is all provided by URL address.
URL is redirected and is called again URL rewriting (URL Rewrite), refers to the URL address that server intercepting is imported into, this URL address is redirected to the process of other URL.The URL address sending such as browser is www.autohome.com.cn/364/, the configuration file that server is redirected according to URL, automatically www.autohome.com.cn/XXX.aspx is redirected to in this URL address? id=364, the URL address that client is seen while still sending request, but actual access is the URL address (the resource store path in this URL address, is referred to as to apply path in the present invention) after being redirected.The redirected advantage of URL is: shorten the length of URL address, hide Actual path and improve fail safe; Be easy to user's memory and key in; Being easy to searched engine includes; Be convenient to network upgrade.
The redirected implementation of existing URL is, first obtains the redirected configuration file of URL, for example, be:
Above-mentioned configuration file is xml file, this xml file comprises that many are redirected rule (for regular expression rule), every redirected rule is expressed by <RewriterRule> element, each <RewriterRule> element comprises <LookFor> element and <SendTo> element, the pattern that will search in requested URL is by <LookFor> element representation, replace the character string of found pattern by <SendTo> element representation.
Then, server intercepts file request for example during aaa.xml, in configuration file, find from the top down the redirected rule of coupling, adopt regular expression (regular expression) coupling, result has matched above-mentioned redirected rule, therefore aaa.xml an is redirected to/aaa/bbb.aspx.
Regular expression refers to one " character string " describes a feature, to verify whether another " character string " meets this feature.For example expression formula " mn* " is described the feature of a character string, and this feature is comprised of one " m " and arbitrarily individual " n ", if character string to be verified is " mn ", " mnn " or " mnnnnnn ", these character strings all meet this feature.
But, adopt the speed of matching regular expressions slower, and the system resource consuming is also higher.Particularly for complicated website, its redirected rule for the redirected configuration file of URL is a lot, adopt the mode of matching regular expressions to carry out URL and be redirected and can make the speed of client-access server resource slower, make user's experience effect not good.
Summary of the invention
In view of the above problems, the present invention has been proposed to a kind of URL reorientation method, Apparatus and system that overcomes the problems referred to above or address the above problem is at least in part provided.
According to an aspect of the present invention, provide a kind of URL reorientation method, having comprised:
Obtain the URL of client-requested, from this URL, obtain the first class catalogue of request path;
According to the first class catalogue obtaining, from data dictionary, search the redirected regular collection being associated with this first class catalogue, described data dictionary comprises one or more data entry, and each data entry comprises directory name and the redirected regular collection being associated; And
Request path in the URL of request is carried out to canonical with the redirected regular collection finding and mate, and according to the redirected rule matching, URL is redirected.
Alternatively, described method also comprises step: according to the redirected configuration file of URL, generate described data dictionary, comprising:
From configuration file, read one by one and be redirected rule;
For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.
Alternatively, describedly according to the redirected configuration file of URL, generate described data dictionary, comprising: from configuration file, read one by one and be redirected rule; For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.
Alternatively, the described first class catalogue and adding in data dictionary that this redirected rule is associated that this is redirected to regular request path, comprising: whether the first class catalogue that judges request path is present in data dictionary; When this first class catalogue is not present in data dictionary, this first class catalogue and this redirected rule are added in data dictionary as a data entry; When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary.
Alternatively, when the request path of the redirected rule of configuration file be a plurality of first class catalogues form first class catalogue set time, adding in data dictionary that the described first class catalogue that this is redirected to regular request path is associated with this redirected rule is, respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated.
Alternatively, describedly request path in the URL of request is carried out to canonical with the redirected regular collection finding mate, and according to the redirected rule matching, URL is redirected, comprise: from the redirected regular collection finding, take out and be redirected rule one by one, the redirected rule of this request path and this is carried out to canonical and mate; When matching certain redirected rule, this request path is redirected to the application path of being redirected in rule; When all redirected rules are not all mated, this URL is not redirected.
According to a further aspect in the invention, provide a kind of URL redirection device, having comprised:
First class catalogue acquiring unit, is suitable for obtaining the URL of client-requested, obtains the first class catalogue of request path from this URL;
Dictionary lookup unit, be suitable for from data dictionary, searching according to the first class catalogue obtaining the redirected regular collection being associated with this first class catalogue, described data dictionary comprises one or more data entry, and each data entry comprises directory name and the redirected regular collection being associated; And
Be redirected unit, be suitable for that the request path in the URL of request is carried out to canonical with the redirected regular collection finding and mate, and according to the redirected rule matching, URL is redirected.
Alternatively, described device also comprises data dictionary generation unit, is suitable for:
From configuration file, read one by one and be redirected rule;
For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.
Alternatively, described data dictionary generation unit is further adapted for: whether the first class catalogue that judges request path is present in data dictionary; When this first class catalogue is not present in data dictionary, this first class catalogue and this redirected rule are added in data dictionary as a data entry; When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary.
Alternatively, when the request path of the redirected rule of configuration file be a plurality of first class catalogues form first class catalogue set time, described data dictionary generation unit is respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated.
Alternatively, described redirected unit is further adapted for: from the redirected regular collection finding, take out and be redirected rule one by one, the redirected rule of this request path and this is carried out to canonical and mate; When matching certain redirected rule, this request path is redirected to the application path of being redirected in rule; When all redirected rules are not all mated, this URL is not redirected.
According to another aspect of the invention, a kind of URL Redirectional system is provided, comprise a plurality of clients, provide the server end of various network resources for these clients, client and server end is intercommunication mutually via internet, wherein, described server end comprises above-mentioned URL redirection device.
The present invention is by sorting out the redirected rule in configuration file in advance according to the first class catalogue of request path, and adopt data dictionary to preserve, carrying out URL while being redirected, first by data dictionary, search first class catalogue, found and carried out again matching regular expressions, otherwise do not carry out matching regular expressions, avoided directly carrying out the situation of matching regular expressions failure, thereby improved the efficiency of match hit, and then improved the speed of resource in the redirected processing speed of URL and client-access server.And what carry out matching regular expressions is only a subset of all redirected rules, has further improved the redirected processing speed of URL.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to better understand technological means of the present invention, and can be implemented according to the content of specification, and for above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Accompanying drawing explanation
By reading below detailed description of the preferred embodiment, various other advantage and benefits will become cheer and bright for those of ordinary skills.Accompanying drawing is only for the object of preferred implementation is shown, and do not think limitation of the present invention.And in whole accompanying drawing, by identical reference symbol, represent identical parts.In the accompanying drawings:
Fig. 1 shows the structure chart of URL Redirectional system according to an embodiment of the invention;
Fig. 2 shows the structure chart of URL redirection device according to an embodiment of the invention; And
Fig. 3 shows the flow chart of URL reorientation method according to an embodiment of the invention.
Embodiment
Exemplary embodiment of the present disclosure is described below with reference to accompanying drawings in more detail.Although shown exemplary embodiment of the present disclosure in accompanying drawing, yet should be appreciated that and can realize the disclosure and the embodiment that should do not set forth limits here with various forms.On the contrary, it is in order more thoroughly to understand the disclosure that these embodiment are provided, and can by the scope of the present disclosure complete convey to those skilled in the art.
Fig. 1 shows the structure chart of URL Redirectional system according to an embodiment of the invention.As shown in Figure 1, URL Redirectional system comprises a plurality of clients 110 (there is shown 3), for these clients 110 provide the server end 120 of various network resources, and client 110 and server end 120 be intercommunication mutually via internet.
In embodiments of the present invention, client 110 can be any equipment that can present the Internet resources that obtain from server end 120 in this area, includes but not limited to desktop computer, notebook computer, personal digital assistant, intelligent mobile terminal and panel computer etc.Client 110 has operating system, and in operating system, operation has browser, and described browser can present the Internet resources that obtain from server end 120, for example web page files.
Server end 120 is answered the request (for example http request) of client 110 and asked Internet resources is returned to client 110.During the Internet resources of client 110 request access server ends 120, need agreement, the server of request, the information such as the store path of request resource (being referred to as request path in the present invention) of determining that request is used, above-mentioned information is all provided by URL address.For example, the request URL of client 110 is http://www.autohome.com.cn/aaa/20/article.html, and the request path in this URL is /aaa/20/article.html, and the first class catalogue of this request path is /aaa.
In some cases, the URL that server end 120 need to be asked client 110 is redirected, the request path being about in URL is rewritten as other paths (being referred to as to apply path in the present invention) in server end 120, therefore, server end 120 also comprises URL redirection device 200, by URL redirection device 200, carries out being redirected of URL.For example, does is URL redirection device 200 redirected above-mentioned URL into http://www.autohome.com.cn/ccc.aspx? does is does is id=20, about to request path/aaa/20/article.html and redirected to application path/ccc.aspx? id=20.After URL is redirected, does is the URL of client 110 actual access http://www.autohome.com.cn/ccc.aspx? id=20, client 110 sees that URL's remains http://www.autohome.com.cn/aaa/20/article.html, like this, just shorten the length of the URL address of user's input, thereby hidden the fail safe that Actual path has improved Internet resources.
Fig. 2 shows the structure chart of URL redirection device 200 according to an embodiment of the invention.Described URL is heavy to be arranged in server end 120 to device 200, and the URL that is suitable for client 110 to ask is redirected.
With reference to Fig. 2, described URL redirection device 200 comprises data dictionary generation unit 210, first class catalogue acquiring unit 220, dictionary lookup unit 230 and redirected unit 240.
Data dictionary generation unit 210 is suitable for the configuration file generated data dictionary redirected according to URL.The data dictionary generating comprises one or more data entries, redirected rule (for the rule based on the regular expression) set that each data entry comprises directory name and is associated with this directory name, described directory name is the first class catalogue of request path in the redirected rule of configuration file, the redirected regular collection being associated with this directory name is the set in configuration file with the redirected rule that the request path of this first class catalogue is corresponding, the subset that this set is the included all redirected rules of configuration file.That is to say, data dictionary generation unit 210 is sorted out the redirected rule in configuration file according to the first class catalogue of request path, redirected rule corresponding to request path that first class catalogue is identical is classified as a class, and is stored as a data entry of data dictionary.
Server end 120 for example stores for carrying out the redirected configuration file of URL in Website server, and described configuration file comprises that some are redirected rule, and described redirected rule is the redirected rule based on regular expression.This configuration file stores in Website server after for example can being set by website design personnel.
For example, in server end 120, the configuration file of storage is as follows:
Above-mentioned configuration file is xml file, this xml file comprises that 4 are redirected rule (for regular expression rule), every redirected rule is expressed by <RewriterRule> element, each <RewriterRule> element comprises <LookFor> element and <SendTo> element, the pattern that will search in requested URL is by <LookFor> element representation, replace the character string of found pattern by <SendTo> element representation.
For example, in above-mentioned configuration file, article one, the pattern that is redirected in regular <LookFor> element "~/aaa/ (d+)/" and indicates to search is: the first class catalogue of URL request path is /aaa/, second-level directory is/(d+), and wherein " d+ " represents one or more numerals; Article one be redirected in regular <SendTo> element "~/bbb.aspx? id=$ 1 " represent when URL request path mates with "~/aaa/ (d+)/", by the request path of this URL kind replace with application path "/bbb.aspx? id=$ 1 ", wherein $ 1 represents in "~/aaa/ (d+)/" value of regular expression in first bracket.
Data dictionary generation unit 210 can carry out the configuration file generated data dictionary redirected according to URL in the following manner: from configuration file, read one by one and be redirected rule; For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.Particularly, be redirected rule for every that reads, first judge whether this first class catalogue that is redirected regular request path is present in data dictionary (judge in data dictionary whether exist the data entry corresponding with this request path); Then, when this first class catalogue is not present in data dictionary, this first class catalogue and this redirected regular incidence relation are added in data dictionary as a data entry; When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary and (upgrade data entry corresponding with this first class catalogue in data dictionary, this redirected rule is added in the included redirected regular collection of this data entry).
In addition, the request path of the redirected rule in described configuration file may be the first class catalogue set of a plurality of first class catalogues formations.For example, for the last item in above-mentioned configuration file, be redirected in regular <LookFor> element, the first of request path/(a1|a2|a3) is the set that 3 first class catalogues form, be respectively/a1 ,/a2 and/a3.In such cases, data dictionary generation unit 210 is respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated, for above-mentioned example, in data dictionary, add 3 data entries, be respectively/a1 of the directory name of these three data entries ,/a2 and/a3, the redirected rule being associated is:
<LookFor>~/(a1|a2|a3)/\ad{6}/(\d+)12\.html</LookFor>
<SendTo>~/mmm/ddd.aspx?id=$2</SendTo>
In addition, the first class catalogue of the request path of the redirected rule in described configuration file may be also numerical character string variable, for example, be/(d+), in such cases, in data dictionary, data strip destination directory name is called this numerical character string variable.
Data entry in data dictionary specifically can be stored mode with key-value (key-value).For example, key corresponding to data dictionary generating according to above-mentioned configuration file is respectively: aaa, ddd, a1, a2, a3, and the value that aaa is corresponding comprises that two are redirected rule, are respectively:
The value that ddd is corresponding comprises that is redirected a rule, as follows:
A1, a2, the value that a3 is corresponding are identical, comprise that is redirected a rule, as follows:
First class catalogue acquiring unit 220 is suitable for obtaining the URL of client 110 requests, obtains the first class catalogue of request path from this URL.When client 110 needs the Internet resources in access services device end 120, send request (for example http request) to server end 120, this request comprises the URL that these Internet resources are corresponding, first class catalogue acquiring unit 220 can obtain the request path in this URL, and obtains the first class catalogue in this request path.
For example, the request path in the URL of client 110 requests is /mmm/20/ that corresponding first class catalogue is mmm; Again for example, the request path in the URL of client 110 requests is /aaa/20/article.html that corresponding first class catalogue is aaa.
The first class catalogue that dictionary lookup unit 230 is suitable for obtaining according to first class catalogue acquiring unit 220 is searched the redirected regular collection being associated from data dictionary.For example, when the first class catalogue getting is mmm, according to mmm, search data dictionary, in data dictionary, not having directory name is the data entry of mmm, searches unsuccessfully; Again for example, when the first class catalogue getting is aaa, according to aaa, search data dictionary, in data dictionary, having directory name is the data entry of aaa, and in this data entry, the redirected regular collection associated with aaa comprises that two are redirected rule, as follows:
In addition, when accessed first class catalogue is digit strings, this digit strings is directly mated with the numerical character string variable in data dictionary.
Redirected unit 240 is suitable for that the request path in the URL of request is carried out to canonical with the redirected regular collection finding and mates (matching regular expressions), and according to the redirected rule matching, URL is redirected.Being redirected unit 240 can take out and be redirected rule one by one from the redirected regular collection finding, and the redirected rule of this request path and this is carried out to canonical and mate; When matching certain redirected rule, this request path is redirected to the application path in matched redirected rule; When all redirected rules are not all mated, this URL is not redirected.
Certainly, if when the first class catalogue that dictionary lookup unit 230 obtains according to first class catalogue acquiring unit 220 is searched data dictionary, if searched unsuccessfully, be redirected unit 240 and also this URL be not redirected.
For example, the request path in the URL of client 110 request is /mmm/20/, according to first class catalogue mmm, searches unsuccessfully, this URL is not redirected.
Again for example, the request path in the URL of client 110 request be/aaa/20/article.html, and above-mentioned two the redirected rules that find according to first class catalogue aaa are carried out matching regular expressions, and result matches second and is redirected regular:
So, according to this second, be redirected rule, the request path/aaa/20/article.html in the URL of request redirected to application path/ccc.aspx? id=20.
According to the URL redirection device of the embodiment of the present invention, in advance the redirected rule in configuration file is sorted out according to the first class catalogue of request path, and adopt data dictionary to preserve, carrying out URL while being redirected, first by data dictionary, search first class catalogue, found and carried out again matching regular expressions, otherwise do not carry out matching regular expressions, avoided directly carrying out the situation of matching regular expressions failure, thereby improved the efficiency of match hit, and then improved the speed of resource in the redirected processing speed of URL and client-access server.And what carry out matching regular expressions is only a subset of all redirected rules, has further improved the redirected processing speed of URL.
For example, for above-mentioned, comprise that request path is /URL of mmm/20/, according to existing URL redirection scheme, even if do not exist in configuration file and/redirected rule that mmm/20/ is corresponding, also need all redirected rule in configuration file to carry out successively matching regular expressions processing procedure, waste a large amount of server process resources, and caused the speed of Internet resources in client-access server also slower; And according to the URL redirection scheme of the embodiment of the present invention, when searching less than the canonical table expression formula set corresponding with first class catalogue mmm according to data dictionary, do not proceed the coupling of regular expression, directly determine this URL not to be redirected, significantly improved the redirected processing speed of URL.
It should be noted that, above-mentioned data dictionary generation unit 210 is selectable unit, be can not comprise described data dictionary generation unit 210 in described URL redirection device 200, data dictionary is input to server end 120 after can be pre-configured, by URL redirection device 200, is used.
Fig. 3 shows the flow chart of URL reorientation method according to an embodiment of the invention, and this URL reorientation method is carried out by server end.
With reference to Fig. 3, this URL reorientation method starts from step S302.In step S302, the configuration file generated data dictionary redirected according to URL.The data dictionary generating comprises one or more data entries, redirected rule (for the rule based on the regular expression) set that each data entry comprises directory name and is associated with this directory name, described directory name is the first class catalogue of request path in the redirected rule of configuration file, the redirected regular collection being associated with this directory name is the set in configuration file with the redirected rule that the request path of this first class catalogue is corresponding, the subset that this set is the included all redirected rules of configuration file.That is to say, be that the redirected rule in configuration file is sorted out according to the first class catalogue of request path, and redirected rule corresponding to request path that first class catalogue is identical is classified as a class, and be stored as a data entry of data dictionary.
In step S302, can carry out in the following manner the configuration file generated data dictionary redirected according to URL: from configuration file, read one by one and be redirected rule; For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.Particularly, be redirected rule for every that reads, first judge whether this first class catalogue that is redirected regular request path is present in data dictionary (judge in data dictionary whether exist the data entry corresponding with this request path); Then, when this first class catalogue is not present in data dictionary, this first class catalogue and this redirected regular incidence relation are added in data dictionary as a data entry; When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary and (upgrade data entry corresponding with this first class catalogue in data dictionary, this redirected rule is added in the included redirected regular collection of this data entry).
In addition, the request path of the redirected rule in described configuration file may be the first class catalogue set of a plurality of first class catalogues formations.In such cases, be respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated.In addition, the first class catalogue of the request path of the redirected rule in described configuration file may be also numerical variable variable, for example, be/(d+), in such cases, in data dictionary, data strip destination directory name is called this numerical variable variable.Wherein, the data entry in data dictionary specifically can be stored mode with key-value (key-value).
It should be noted that, in step S302 the performed processing processing performed with data dictionary generation unit 210 identical, specifically can, with reference to the description to data dictionary creation unit 210 above, not repeat here.
After having generated data dictionary in advance by step S302, method enters step S304.In step S304, obtain the URL of client-requested, from this URL, obtain the first class catalogue of request path.It should be noted that, in step S304 the performed processing processing performed with first class catalogue acquiring unit 220 identical, specifically can, with reference to the description to first class catalogue acquiring unit 220 above, not repeat here.
After getting the first class catalogue of request path, method enters step S306.In step S306, according to the first class catalogue obtaining, from data dictionary, search the redirected regular collection being associated.
It should be noted that, in step S306 the performed processing processing performed with dictionary lookup unit 230 identical, specifically can, with reference to the description to dictionary lookup unit 230 above, not repeat here.
After finding the redirected regular collection being associated, method enters step S308.In step S308, the request path in the URL of request is carried out to canonical with the redirected regular collection finding and mate, and according to the redirected rule matching, URL is redirected.Can from the redirected regular collection finding, take out and be redirected rule one by one, the redirected rule of this request path and this be carried out to canonical and mate; When matching certain redirected rule, this request path is redirected to the application path in matched redirected rule; When all redirected rules are not all mated, this URL is not redirected.Certainly, if while searching unsuccessfully in step S304, this URL is not redirected in step S306 yet.
It should be noted that, in step S308 the performed processing processing performed with redirected unit 240 identical, specifically can, with reference to the description of counterweight directed element 240 above, not repeat here.
According to the URL reorientation method of the embodiment of the present invention, in advance the redirected rule in configuration file is sorted out according to the first class catalogue of request path, and adopt data dictionary to preserve, carrying out URL while being redirected, first by data dictionary, search first class catalogue, found and carried out again matching regular expressions, otherwise do not carry out matching regular expressions, avoided directly carrying out the situation of matching regular expressions failure, thereby improved the efficiency of match hit, and then improved the speed of resource in the redirected processing speed of URL and client-access server.And what carry out matching regular expressions is only a subset of all redirected rules, has further improved the redirected processing speed of URL.
It should be noted that, above-mentioned step S302 is optional step, and described URL reorientation method can not comprise described step S302, and data dictionary is input in server end after can be pre-configured, by described URL reorientation method, is used.
According to URL reorientation method and the device of the embodiment of the present invention, for ease of the realization of code, when carrying out website design, the first class catalogue for the redirected configuration file of URL corresponding to this website can be defined as:
1, numerical character string variable: be for example (d+).
2, character string constant (generally being formed by numeral and letter):
(1) set
File set: take ". " as file characteristic, for example, (news_site.xml|bbs_site.xml) (news.xml).
Catalogue set: for example, (photo|newbran), (audi).
(2) non-set (single)
Single document: take ". " as file characteristic, for example, a.html, a.Xml.
Single catalogue: for example, chezhan, ExpertBlog.
The algorithm providing at this is intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with demonstration.Various general-purpose systems also can with based on using together with this teaching.According to description above, it is apparent constructing the desired structure of this type systematic.In addition, the present invention is not also for any certain programmed language.It should be understood that and can utilize various programming languages to realize content of the present invention described here, and the description of above language-specific being done is in order to disclose preferred forms of the present invention.
In the specification that provided herein, a large amount of details have been described.Yet, can understand, embodiments of the invention can not put into practice in the situation that there is no these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand one or more in each inventive aspect, in the above in the description of exemplary embodiment of the present invention, each feature of the present invention is grouped together into single embodiment, figure or sometimes in its description.Yet, the method for the disclosure should be construed to the following intention of reflection: the present invention for required protection requires than the more feature of feature of clearly recording in each claim.Or rather, as reflected in claims below, inventive aspect is to be less than all features of disclosed single embodiment above.Therefore, claims of following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and can the module in the equipment in embodiment are adaptively changed and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and can put them into a plurality of submodules or subelement or sub-component in addition.At least some in such feature and/or process or unit are mutually repelling, and can adopt any combination to combine all processes or the unit of disclosed all features in this specification (comprising claim, summary and the accompanying drawing followed) and disclosed any method like this or equipment.Unless clearly statement in addition, in this specification (comprising claim, summary and the accompanying drawing followed) disclosed each feature can be by providing identical, be equal to or the alternative features of similar object replaces.
In addition, those skilled in the art can understand, although embodiment more described herein comprise some feature rather than further feature included in other embodiment, the combination of the feature of different embodiment means within scope of the present invention and forms different embodiment.For example, in the following claims, the one of any of embodiment required for protection can be used with compound mode arbitrarily.
All parts embodiment of the present invention can realize with hardware, or realizes with the software module moved on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that and can use in practice microprocessor or digital signal processor (DSP) to realize according to the some or all functions of the some or all parts in the URL redirection device of the embodiment of the present invention.The present invention for example can also be embodied as, for carrying out part or all equipment or device program (, computer program and computer program) of method as described herein.Realizing program of the present invention and can be stored on computer-readable medium like this, or can there is the form of one or more signal.Such signal can be downloaded and obtain from internet website, or provides on carrier signal, or provides with any other form.
It should be noted above-described embodiment the present invention will be described rather than limit the invention, and those skilled in the art can design alternative embodiment in the situation that do not depart from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and is not listed as element or step in the claims.Being positioned at word " " before element or " one " does not get rid of and has a plurality of such elements.The present invention can be by means of including the hardware of some different elements and realizing by means of the computer of suitably programming.In having enumerated the unit claim of some devices, several in these devices can be to carry out imbody by same hardware branch.The use of word first, second and C grade does not represent any order.Can be title by these word explanations.

Claims (10)

1. a URL reorientation method, comprising:
Obtain the URL of client-requested, from this URL, obtain the first class catalogue of request path;
According to the first class catalogue obtaining, from data dictionary, search the redirected regular collection being associated with this first class catalogue, described data dictionary comprises one or more data entry, and each data entry comprises directory name and the redirected regular collection being associated; And
Request path in the URL of request is carried out to canonical with the redirected regular collection finding and mate, and according to the redirected rule matching, URL is redirected.
2. URL reorientation method as claimed in claim 1, also comprises step:
According to the redirected configuration file of URL, generate described data dictionary, comprising:
From configuration file, read one by one and be redirected rule;
For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.
3. URL reorientation method as claimed in claim 2, wherein, described by the first class catalogue and adding in data dictionary that this redirected rule is associated of this redirected regular request path, comprising:
Whether the first class catalogue that judges request path is present in data dictionary;
When this first class catalogue is not present in data dictionary, this first class catalogue and this redirected rule are added in data dictionary as a data entry;
When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary.
4. URL reorientation method as claimed in claim 3, wherein, when the request path of the redirected rule of configuration file be a plurality of first class catalogues form first class catalogue set time, adding in data dictionary that the described first class catalogue that this is redirected to regular request path is associated with this redirected rule is, respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated.
5. URL reorientation method as claimed in claim 1, wherein, describedly carries out canonical by the request path in the URL of request with the redirected regular collection finding and mates, and according to the redirected rule matching, URL is redirected, and comprising:
From the redirected regular collection finding, take out and be redirected rule one by one, the redirected rule of this request path and this is carried out to canonical and mate;
When matching certain redirected rule, this request path is redirected to the application path of being redirected in rule;
When all redirected rules are not all mated, this URL is not redirected.
6. a URL redirection device, comprising:
First class catalogue acquiring unit, is suitable for obtaining the URL of client-requested, obtains the first class catalogue of request path from this URL;
Dictionary lookup unit, be suitable for from data dictionary, searching according to the first class catalogue obtaining the redirected regular collection being associated with this first class catalogue, described data dictionary comprises one or more data entry, and each data entry comprises directory name and the redirected regular collection being associated; And
Be redirected unit, be suitable for that the request path in the URL of request is carried out to canonical with the redirected regular collection finding and mate, and according to the redirected rule matching, URL is redirected.
7. URL redirection device as claimed in claim 6, wherein, also comprises data dictionary generation unit, is suitable for:
From configuration file, read one by one and be redirected rule;
For every that reads redirected rule, this is redirected to the first class catalogue and adding in data dictionary that this redirected rule is associated of regular request path.
8. URL redirection device as claimed in claim 7, wherein, described data dictionary generation unit is further adapted for:
Whether the first class catalogue that judges request path is present in data dictionary;
When this first class catalogue is not present in data dictionary, this first class catalogue and this redirected rule are added in data dictionary as a data entry;
When this first class catalogue is present in data dictionary, this redirected rule is added in the redirected regular collection being associated with this first class catalogue in data dictionary.
9. URL redirection device as claimed in claim 8, wherein, when the request path of the redirected rule of configuration file be a plurality of first class catalogues form first class catalogue set time, described data dictionary generation unit is respectively by each first class catalogue in first class catalogue set and adding in data dictionary that this redirected rule is associated.
10. a URL Redirectional system, comprise a plurality of clients, provide the server end of various network resources for these clients, client and server end is intercommunication mutually via internet, and wherein, described server end comprises the URL redirection device as described in any one in claim 6 to 9.
CN201410314533.7A 2014-07-03 2014-07-03 A kind of URL reorientation methods, apparatus and system Active CN104065736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410314533.7A CN104065736B (en) 2014-07-03 2014-07-03 A kind of URL reorientation methods, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410314533.7A CN104065736B (en) 2014-07-03 2014-07-03 A kind of URL reorientation methods, apparatus and system

Publications (2)

Publication Number Publication Date
CN104065736A true CN104065736A (en) 2014-09-24
CN104065736B CN104065736B (en) 2017-11-28

Family

ID=51553263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410314533.7A Active CN104065736B (en) 2014-07-03 2014-07-03 A kind of URL reorientation methods, apparatus and system

Country Status (1)

Country Link
CN (1) CN104065736B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106547524A (en) * 2015-09-18 2017-03-29 百度在线网络技术(北京)有限公司 A kind of method and apparatus for software transfer
CN107181779A (en) * 2016-03-10 2017-09-19 阿里巴巴集团控股有限公司 Processing method, the device and system of access request
CN107733972A (en) * 2017-08-28 2018-02-23 阿里巴巴集团控股有限公司 A kind of short linking analytic method, device and equipment
CN109471858A (en) * 2018-09-28 2019-03-15 沈文策 Address conversion method, article access method, device and electronic equipment
CN110519656A (en) * 2018-05-22 2019-11-29 中国电信股份有限公司 Playback method, system and the server of adaptive stream media
CN112804373A (en) * 2020-12-30 2021-05-14 微医云(杭州)控股有限公司 Interface domain name determining method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101242336A (en) * 2008-03-13 2008-08-13 杭州华三通信技术有限公司 Method for remote access to intranet Web server and Web proxy server
CN101452483A (en) * 2008-12-25 2009-06-10 阿里巴巴集团控股有限公司 Website access method and system
US20100131487A1 (en) * 2008-11-24 2010-05-27 Microsoft Corporation Http cache with url rewriting
CN101727447A (en) * 2008-10-10 2010-06-09 浙江搜富网络技术有限公司 Generation method and device of regular expression based on URL

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101242336A (en) * 2008-03-13 2008-08-13 杭州华三通信技术有限公司 Method for remote access to intranet Web server and Web proxy server
CN101727447A (en) * 2008-10-10 2010-06-09 浙江搜富网络技术有限公司 Generation method and device of regular expression based on URL
US20100131487A1 (en) * 2008-11-24 2010-05-27 Microsoft Corporation Http cache with url rewriting
CN101452483A (en) * 2008-12-25 2009-06-10 阿里巴巴集团控股有限公司 Website access method and system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106547524A (en) * 2015-09-18 2017-03-29 百度在线网络技术(北京)有限公司 A kind of method and apparatus for software transfer
CN107181779A (en) * 2016-03-10 2017-09-19 阿里巴巴集团控股有限公司 Processing method, the device and system of access request
CN107181779B (en) * 2016-03-10 2021-09-10 阿里巴巴集团控股有限公司 Method, device and system for processing access request
CN107733972A (en) * 2017-08-28 2018-02-23 阿里巴巴集团控股有限公司 A kind of short linking analytic method, device and equipment
WO2019042240A1 (en) * 2017-08-28 2019-03-07 阿里巴巴集团控股有限公司 Short-link parsing method, apparatus and device
TWI682653B (en) * 2017-08-28 2020-01-11 香港商阿里巴巴集團服務有限公司 Short link analysis method, device and equipment
US10733257B2 (en) 2017-08-28 2020-08-04 Alibaba Group Holding Limited Short-link parsing methods, apparatus, and devices
CN107733972B (en) * 2017-08-28 2020-09-08 阿里巴巴集团控股有限公司 Short link analysis method, device and equipment
CN110519656A (en) * 2018-05-22 2019-11-29 中国电信股份有限公司 Playback method, system and the server of adaptive stream media
CN109471858A (en) * 2018-09-28 2019-03-15 沈文策 Address conversion method, article access method, device and electronic equipment
CN112804373A (en) * 2020-12-30 2021-05-14 微医云(杭州)控股有限公司 Interface domain name determining method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN104065736B (en) 2017-11-28

Similar Documents

Publication Publication Date Title
CN100367276C (en) Method and appts for searching within a computer network
US9646100B2 (en) Methods and systems for providing content provider-specified URL keyword navigation
US10250526B2 (en) Method and apparatus for increasing subresource loading speed
US9811599B2 (en) Methods and systems for providing content provider-specified URL keyword navigation
CN104065736A (en) URL redirection method, device, and system
US8631097B1 (en) Methods and systems for finding a mobile and non-mobile page pair
CN104063460A (en) Method and device for loading webpage in browser
CN102833258A (en) Website access method and system
US20070162524A1 (en) Network document management
CN103221951A (en) Predictive query suggestion caching
CN103699669A (en) Method for message pushing in browser and browser terminal
CN103179125A (en) Display method of website authentication information and browser
CN110266661A (en) A kind of authorization method, device and equipment
CN102982117A (en) Information search method and device
US20150100563A1 (en) Method for retaining search engine optimization in a transferred website
CN102982118A (en) Searching method and device based on favorites
CN103793508B (en) A kind of loading recommendation information, the methods, devices and systems of network address detection
CN111770072B (en) Method and device for accessing function page through single sign-on
EP2711852A1 (en) Methods and systems for providing content provider-specified URL keyword navigation
CN110955855B (en) Information interception method, device and terminal
CN105138912A (en) Method and device for generating phishing website detection rules automatically
CN103618742A (en) Method and system for acquiring sub domain names and webmaster permission verification method
US9953105B1 (en) System and method for creating subdomains or directories for a domain name
CN103905434A (en) Method and device for processing network data
CN104778233A (en) Searching method and device based on click rate

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant