uweb/en/redirect/index.html

112 lines
5.1 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../style.css#" type="text/css" />
<title>Resource redirection</title>
<script type="text/javascript">
function findLang(){
let href = location.href;
for(let i=href.length-1;i>0;i--){
if('/'==href.charAt(i) && '/'==href.charAt(i-3))
return i;
}
return 0;
}
function nav2(page){
let i = findLang();
location.href = location.href.substring(0,i+1)+page;
}
function nav2Lang(lang){
let i = findLang();
let href = location.href;
location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
}
</script>
</head>
<body>
<header class='header'>
<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>
<a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
<nav>
</nav>
</header>
<br />
<div class="container">
<h1 class="title">Resource redirection
<br>
<span class="subtitle"></span>
</h1>
<ul class="tags">
<li><a href="../tags/redirection/index.html#">redirection</a> </li>
</ul>
<p>⚠️<span style="color:red">Redirection forwards cookies</span> with the setting option &quot;Redirect cookies&quot; enabled, so use the options with care.</p>
<h4 id="setting-options-url-redirection-vs-resource-redirection">Setting options: &quot;Url redirection&quot; vs. &quot;Resource redirection&quot;</h4>
<p>&quot;Url redirection&quot; redirects the main/page url only while &quot;Resource redirection&quot; is for all urls in the page.</p>
<h4 id="global-redirection">Global redirection</h4>
<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 &quot;Resource redirection&quot; or both &quot;Url redirection&quot; and &quot;Redirect cookies&quot;.</p>
<p>When a valid global redirection url is set, the &quot;default.redirect&quot; has no effect, and any url resource is fetched with the new url by appending the original url to the global redirection url.</p>
<ul>
<li>
<p>If the global redirection url ends with '/', '?', or '=', then the resource is fetched with by the url &quot;[global redirection url] + [url]&quot;. For example, &quot;https://domain.com/pathXXX/https://cnn.com&quot;.</p>
</li>
<li>
<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 &quot;[global redirection url] + '/'+ [scheme]+ '/' + [url without scheme]&quot;. For example, when the global redirection url is &quot;https://domain.com/pathXXX&quot;, the real url to visit &quot;https://cnn.com&quot; is &quot;https://domain.com/pathXXX/https/cnn.com&quot;.</p>
</li>
</ul>
<h4 id="defaultredirect-valid-only-without-global-redirection-url">&quot;default.redirect&quot; (valid only without global redirection url)</h4>
<p>Click the following links to append mirrors to the file &quot;default.redirect&quot;:<br>
<a target="_self" href="i:0gdefault.redirect:../../zh/searchurl/txt/redirect.cfg">google recaptcha mirror</a></p>
<p>Each line of the file &quot;default.redirect&quot; has the following format:<br>
[domain name]:[regular expression]:[replacement expression]</p>
<p>in which &quot;[regular expression]&quot; is as defined by java language, and cannot have &quot;:&quot; inside; if empty, it defaults to be same as &quot;[domain name]&quot;.</p>
<h5 id="ways-to-enable-domain-redirection">Ways to enable domain redirection:</h5>
<ul>
<li><a href="../urls/index.html#">Long pressing the image button</a></li>
<li>Long pressing the setting button, enable the option &quot;url redirection&quot;.</li>
<li>Long pressing the setting button, enable the option &quot;Resource redirection&quot;.</li>
</ul>
</div>
<p>Last Modified: 7 April 2024<br>
more details on global redirection url<br>
<pre></pre>
</p>
<script id='jsgiscus'
src='https://giscus.app/client.js'
data-repo="torappinfo/uweb"
data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
data-category="Announcements"
data-category-id="DIC_kwDOEgNLGc4CQjsh"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="light"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous" async>
</script>
<footer class="site-footer">
<div class="container">
&copy; 2018-2024 Richard H. Cao
</div>
</footer>
<!-- 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/>. -->
</body>
</html>