A Chrome extension that automatically redirects URLs based on configurable rules, such as adding prefixes to specific patterns. Built with React, TypeScript, and Webpack.
- Configurable Redirect Rules: Create rules with patterns (simple or regex) and prefixes to automatically redirect matching URLs.
- Enable/Disable Rules: Toggle individual rules or the entire extension.
- Redirect Logging: View a history of redirects with details like original/redirected URLs and timestamps.
- Notifications: Optional notifications for each redirect.
- Popup UI: Manage rules, view logs, and configure settings from the extension popup.
- Content Script Monitoring: Handles dynamic URL changes in single-page applications (SPAs).
- Clone the repository:
git clone https://github.com/nabobery/redirect-url-extension.git
- Install dependencies:
or
npm install
yarn install
- Build the extension:
npm run build
- Load the extension in Chrome:
- Go to
chrome://extensions/. - Enable "Developer mode".
- Click "Load unpacked" and select the
dist/folder.
- Go to
- Click the extension icon to open the popup.
- In the "Rules" tab, add new rules by specifying a name, pattern (e.g.,
*.example.com), replacement (e.g.,proxy.or a regex template like$1ss$2), and whether it's a regex pattern. - Enable/disable the extension or individual rules in the "Settings" tab.
- View redirect history in the "Logs" tab.
- When visiting a matching URL, the extension will automatically redirect and (optionally) notify you.
Here are some practical examples of redirect rules you can set up in the extension. These demonstrate both simple and regex-based transformations.
- Rule Name: YouTube Saver
- URL Pattern:
^(https?://(?:www\.)?)youtube\.com(.*)$(matches YouTube URLs, making 'www.' optional) - Replacement:
$1ssyoutube.com$2(inserts 'ss' into the domain while preserving the protocol and path) - Use Regular Expression: Checked
This transforms https://www.youtube.com/watch?v=JUaOFaI2UnY to https://www.ssyoutube.com/watch?v=JUaOFaI2UnY (a common downloader site).
- Rule Name: Medium Bypass
- URL Pattern:
^(https?://(?:www\.)?medium\.com/.*)$(matches full Medium article URLs) - Replacement:
https://freedium.cfd/$1(prepends the service URL to the original) - Use Regular Expression: Checked
This transforms https://medium.com/some-article to https://freedium.cfd/https://medium.com/some-article.
Tips: Use tools like regex101.com to test patterns. For non-regex rules, the replacement acts as a simple prefix (e.g., adding a domain or path).
- Settings: Toggle extension, logging, and notifications via the popup.
- Rules: Patterns can be simple (with
*wildcards) or regex. Prefixes can be domains, paths, or full URLs. - Storage: All settings and logs are stored in Chrome's sync storage.
- Scripts:
npm run dev: Build in development mode with watch.npm run build: Production build.npm run clean: Removedist/folder.npm run typecheck: Run TypeScript type checking.
- Tech Stack:
- Frontend: React + TypeScript
- Build: Webpack + ts-loader
- Linting: ESLint
- To test: After building, reload the extension in Chrome.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
MIT License. See LICENSE for details.
Developed by Avinash Changrani.