5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1" />
7 <link rel=
"stylesheet" href=
"../style.css#" type=
"text/css" />
8 <title>Resource redirection
</title>
9 <script type=
"text/javascript">
11 let href
= location
.href
;
12 for(let i
=href
.length
-1;i
>0;i
--){
13 if('/'==href
.charAt(i
) && '/'==href
.charAt(i
-3))
20 location
.href
= location
.href
.substring(0,i
+1)+page
;
22 function nav2Lang(lang
){
24 let href
= location
.href
;
25 location
.href
= location
.href
.substring(0,i
-2)+lang
+location
.href
.substring(i
);
30 <header class='header'
>
31 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('index.html#')">Home
</a> <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('tags/index.html#')">Tags
</a>
34 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2Lang('zh')">简体中文
</a>
42 <div class=
"container">
43 <h1 class=
"title">Resource redirection
45 <span class=
"subtitle"></span>
49 <li><a href=
"../tags/redirection/index.html#">redirection
</a> </li>
52 <p>⚠️
<span style=
"color:red">Redirection forwards cookies
</span> with the setting option
"Redirect cookies
" enabled, so use the options with care.
</p>
53 <h4 id=
"setting-options-url-redirection-vs-resource-redirection">Setting options:
"Url redirection
" vs.
"Resource redirection
"</h4>
54 <p>"Url redirection
" redirects the main/page url only while
"Resource redirection
" is for all urls in the page.
</p>
55 <h4 id=
"global-redirection">Global redirection
</h4>
56 <p><a href=
"i:60/data/data/info.torapp.uweb/files/config.html:https://jamesfengcao.codeberg.page/en/searchurl/config.html">Global redirection
</a> is enabled with the setting option
"Resource redirection
" or both
"Url redirection
" and
"Redirect cookies
".
</p>
57 <p>When a valid global redirection url is set, the
"default.redirect
" has no effect, and any url resource is fetched with the new url by appending the original url to the global redirection url.
</p>
60 <p>If the global redirection url ends with '/', '?', or '=', then the resource is fetched with by the url
"[global redirection url] + [url]
". For example,
"https://domain.com/pathXXX/https://cnn.com
".
</p>
63 <p>(to provide more options to users) If the global redirection url does not end with '/', '?' or '=', it means the global redirection url is naked. then the resource is fetched with by the url
"[global redirection url] + '/'+ [scheme]+ '/' + [url without scheme]
". For example, when the global redirection url is
"https://domain.com/pathXXX
", the real url to visit
"https://cnn.com
" is
"https://domain.com/pathXXX/https/cnn.com
".
</p>
66 <h4 id=
"defaultredirect-valid-only-without-global-redirection-url">"default.redirect
" (valid only without global redirection url)
</h4>
67 <p>Click the following links to append mirrors to the file
"default.redirect
":
<br>
68 <a target=
"_self" href=
"i:0gdefault.redirect:../../zh/searchurl/txt/redirect.cfg">google recaptcha mirror
</a></p>
69 <p>Each line of the file
"default.redirect
" has the following format:
<br>
70 [domain name]:[regular expression]:[replacement expression]
</p>
71 <p>in which
"[regular expression]
" is as defined by java language, and cannot have
":
" inside; if empty, it defaults to be same as
"[domain name]
".
</p>
72 <h5 id=
"ways-to-enable-domain-redirection">Ways to enable domain redirection:
</h5>
74 <li><a href=
"../urls/index.html#">Long pressing the image button
</a>。
</li>
75 <li>Long pressing the setting button, enable the option
"url redirection
".
</li>
76 <li>Long pressing the setting button, enable the option
"Resource redirection
".
</li>
80 <p>Last Modified:
7 April
2024<br>
81 more details on global redirection url
<br>
86 src='https://giscus.app/client.js'
87 data-repo=
"torappinfo/uweb"
88 data-repo-id=
"MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
89 data-category=
"Announcements"
90 data-category-id=
"DIC_kwDOEgNLGc4CQjsh"
93 data-reactions-enabled=
"1"
94 data-emit-metadata=
"0"
95 data-input-position=
"top"
99 crossorigin=
"anonymous" async
>
102 <footer class=
"site-footer">
103 <div class=
"container">
104 © 2018-
2024 Richard H. Cao
107 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->