index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="stylesheet" href="../style.css#" type="text/css" />
  7. <title>Resource redirection</title>
  8. <script>
  9. function findLang(){
  10. let href = location.href;
  11. for(let i=href.length-1;i>0;i--){
  12. if('/'==href.charAt(i) && '/'==href.charAt(i-3))
  13. return i;
  14. }
  15. return 0;
  16. }
  17. function nav2(page){
  18. let i = findLang();
  19. location.href = location.href.substring(0,i+1)+page;
  20. }
  21. function nav2Lang(lang){
  22. let i = findLang();
  23. let href = location.href;
  24. location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <header class='header'>
  30. <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>
  31. <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
  32. <nav>
  33. </nav>
  34. </header>
  35. <br />
  36. <div class="container">
  37. <h1 class="title">Resource redirection
  38. <br>
  39. <span class="subtitle"></span>
  40. </h1>
  41. <ul class="tags">
  42. <li><a href="../tags/redirection/index.html#">redirection</a> </li>
  43. </ul>
  44. <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>
  45. <h4 id="setting-options-url-redirection-vs-resource-redirection">Setting options: &quot;Url redirection&quot; vs. &quot;Resource redirection&quot;</h4>
  46. <p>&quot;Url redirection&quot; redirects the main/page url only while &quot;Resource redirection&quot; is for all urls in the page.</p>
  47. <h4 id="global-redirection">Global redirection</h4>
  48. <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>
  49. <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>
  50. <ul>
  51. <li>
  52. <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>
  53. </li>
  54. <li>
  55. <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>
  56. </li>
  57. </ul>
  58. <h4 id="defaultredirect-valid-only-without-global-redirection-url">&quot;default.redirect&quot; (valid only without global redirection url)</h4>
  59. <p>Click the following links to append mirrors to the file &quot;default.redirect&quot;:<br>
  60. <a target="_self" href="i:0gdefault.redirect:../../zh/searchurl/txt/redirect.cfg">google recaptcha mirror</a></p>
  61. <p>Each line of the file &quot;default.redirect&quot; has the following format:<br>
  62. [domain name]:[regular expression]:[replacement expression]</p>
  63. <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>
  64. <h5 id="ways-to-enable-domain-redirection">Ways to enable domain redirection:</h5>
  65. <ul>
  66. <li><a href="../urls/index.html#">Long pressing the image button</a>。</li>
  67. <li>Long pressing the setting button, enable the option &quot;url redirection&quot;.</li>
  68. <li>Long pressing the setting button, enable the option &quot;Resource redirection&quot;.</li>
  69. </ul>
  70. </div>
  71. <p>Last Modified: 7 April 2024<br>
  72. more details on global redirection url<br>
  73. <pre></pre>
  74. </p>
  75. <script id='jsgiscus'
  76. src='https://giscus.app/client.js'
  77. data-repo="torappinfo/uweb"
  78. data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
  79. data-category="Announcements"
  80. data-category-id="DIC_kwDOEgNLGc4CQjsh"
  81. data-mapping="title"
  82. data-strict="0"
  83. data-reactions-enabled="1"
  84. data-emit-metadata="0"
  85. data-input-position="top"
  86. data-theme="light"
  87. data-lang="en"
  88. data-loading="lazy"
  89. crossorigin="anonymous" async>
  90. </script>
  91. <footer class="site-footer">
  92. <div class="container">
  93. &copy; 2018-2024 Richard H. Cao
  94. </div>
  95. </footer>
  96. <!-- 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/>. -->
  97. </body>
  98. </html>