Reclaim your focus and master your digital habits with URL Redirector. This simple yet powerful extension acts as your personal internet traffic controller, gently nudging you away from distracting websites and towards your goals. Whether you're trying to break a social media loop or simply want to streamline your workflow, URL Redirector provides an unobtrusive way to modify your browsing patterns. Define your own rules, deflect distractions, and take back your time—one redirect at a time.
- Universal Redirection: Redirect any URL (and its subpages) to a target URL.
- Shuffle Mode: Randomize redirection targets (great for A/B testing or auditing).
- Snooze: Temporarily pause specific rules without deleting them.
- Rules Storage: Rules are stored locally using
chrome.storage.local. - Privacy First: Built on the
declarativeNetRequestAPI. This extension does not read your browsing history and cannot see the content of your pages.
- Clone the repository.
- Install dependencies:
npm install - Build the project:
npm run build - Open Chrome and navigate to
chrome://extensions - Enable Developer mode.
- Click Load unpacked and select the
dist/directory created by the build.
- Right-click the extension icon and select Options, or click the extension icon in the toolbar.
- Enter a Source URL (e.g.,
reddit.com) - Enter a Target URL (e.g.,
google.com) - Click Add Rule
The extension will now redirect reddit.com and all its subpages (e.g., reddit.com/r/linux) to google.com.
- Node.js and npm
- Python 3 (optional, for serving files if needed)
| Command | Description |
|---|---|
npm run build |
Compiles TypeScript and copies assets to dist/ |
npm run build:watch |
Rebuilds automatically on file changes |
npm test |
Runs the full test suite (E2E and Build validation) |
npm run bundle |
Creates extension.zip for Chrome Web Store publication |
url-redirector/
├── src/ # TypeScript source files
├── dist/ # Compiled extension (gitignored)
├── test/ # Test suites (E2E, Unit, Mocks)
├── scripts/ # Build and maintenance scripts
├── assets/ # Static assets (HTML, CSS, icons)
├── manifest.json # Extension configuration
└── playwright.config.ts # Testing configuration
The project uses Playwright for comprehensive testing.
# Run all tests
npm test
# Run specifically the build validation tests
npm run test:build
# Run tests with visual UI
npm run test:uiFor more details on the build validation tests, see docs/build-tests.md.
- Build System: Understand how the build and bundle scripts work.
- Build Tests: Details on the build validation test suite.
- Pre-commit Hook: Setup for automated testing before commits.
- Releasing: Instructions on how to version and submit the extension to the Chrome Web Store.
- Source Maps: How to use the bundled sourcemaps for production debugging.
- Store Assets: How to generate high-fidelity assets for the Chrome Web Store.
- Troubleshooting: Solutions for common issues.
- SPA Redirection: How the extension handles Single Page Application redirects.
- Create a branch for your feature or fix.
- Make changes and run
npm testto ensure everything passes. - Commit your changes (the pre-commit hook will run tests automatically).
- Push to GitHub and create a Pull Request.
MIT