AB redirect
✓ Published0🌍 Public
VValIlya
Last edited Mar 1, 2023
Created on Mar 1, 2023
This example demonstrates a userscript that automatically redirects visitors from `ouo.io` pages ending in `.html` to the equivalent `ouo.press` URL while preserving the path, query string, and hash. The script runs at `document-start` on any `ouo.io` match and uses a regular expression to detect the `.html` suffix, then constructs a new URL with `location.protocol`, `location.host`, and the modified path before calling `location.replace()`. No external libraries are used; it relies solely on the browser’s native `location` API and JavaScript string methods.
AI-generated description