Take control of your browsing with custom URL redirects
A powerful, privacy-focused Chrome extension that redirects URLs based on regex patterns you define.
- Custom Regex Rules - Match URLs with powerful regular expressions
- Intuitive Interface - Modern popup UI for easy rule management
- Privacy First - All data stored locally, nothing sent to external servers
- Real-time Redirects - Instant redirects with SPA navigation support
- Sync Across Devices - Rules sync with your Chrome account
- Toggle Controls - Enable/disable rules without deleting them
- Rule Validation - Built-in regex and URL validation
- Download or clone this repository
- Open Chrome and navigate to
chrome://extensions/
- Enable Developer mode (toggle in top right)
- Click Load unpacked and select the extension folder
- The extension icon will appear in your toolbar
Coming soon
- Click the extension icon in your toolbar
- Add your first rule:
- Name:
Block Reddit Subreddits
- Pattern:
^https?:\/\/(?:www\.)?reddit\.com\/r\/[^\/]+(?:\/(?:hot|new|rising|top|best|controversial))?(?:\/?\?t=(hour|day|week|month|year|all))?\/?$
- Destination:
https://www.reddit.com
- Name:
- Enable the rule and test it by visiting any subreddit
YouTube Homepage → Subscriptions Feed
Pattern: ^https?://(?:www\.)?youtube\.com/?(?:\?.*)?$
Destination: https://www.youtube.com/feed/subscriptions
Twitter Timeline → Notifications
Pattern: ^https?://(?:www\.)?twitter\.com/home$
Destination: https://twitter.com/notifications
Reddit Subreddits → Homepage
Pattern: `^https?:\/\/(?:www\.)?reddit\.com\/r\/[^\/]+(?:\/(?:hot|new|rising|top|best|controversial))?(?:\/?\?t=(hour|day|week|month|year|all))?\/?$`
Destination: `https://www.reddit.com`
Remove UTM Parameters
Pattern: ^(https?://.*?)\?utm_.*$
Destination: $1
Local Development Redirect
Pattern: ^https?://production\.example\.com/(.*)$
Destination: http://localhost:3000/$1
- Add Rule Button - Create new redirect rules
- Rule Cards - View and manage existing rules
- Toggle Switches - Enable/disable rules instantly
- Delete Buttons - Remove unwanted rules
- Rule Name - Descriptive name for easy identification
- URL Pattern - Regular expression to match URLs
- Redirect Destination - Where matching URLs should go
- Validation - Real-time validation of patterns and URLs
Basic Patterns:
^https?://example\.com$
- Exact domain match^https?://.*\.example\.com
- Any subdomain^https?://example\.com/.*
- Domain and any path
Special Characters to Escape:
.
→\.
(literal dot)?
→\?
(literal question mark)+
→\+
(literal plus sign)
Groups and Alternatives:
(?:www\.)?
- Optional www subdomain(http|https)
- Match either protocol[^/]+
- One or more non-slash characters
- Use an online regex tester like regex101.com
- Test with actual URLs you want to match
- Enable developer console (F12) to see debug logs
- All rules stored locally using Chrome's
storage.sync
API - Data syncs across your Chrome browsers when signed in
- No external servers - your data never leaves your devices
storage
- Save your custom redirect rulesactiveTab
- Access the current tab's URL for redirects<all_urls>
- Monitor any website for redirect patterns
- Input validation prevents malicious regex patterns
- URL validation ensures safe redirect destinations
- No remote code execution or external dependencies
smart-url-redirector/
├── manifest.json
├── content.js
├── popup.html
├── popup.js
├── assets/
│ └── icons/
└── README.md
-
Clone the repository
git clone https://github.com/r-shafi/redirector.git cd redirector
-
Install in Chrome
- Open
chrome://extensions/
- Enable Developer mode
- Click "Load unpacked" and select the project folder
- Open
-
Make changes
- Edit source files
- Reload extension in Chrome
- Test your changes
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Test thoroughly
- Submit a pull request
Please ensure your contributions maintain the extension's privacy-first approach and don't introduce unnecessary dependencies.
Rule not working:
- Check if the rule is enabled (green toggle)
- Verify your regex pattern with a testing tool
- Open browser console (F12) to see debug logs
- Ensure destination URL includes
http://
orhttps://
Extension not loading:
- Make sure all required files are present
- Check Chrome's extension error console
- Try reloading the extension
Sync issues:
- Ensure you're signed into Chrome
- Check if storage quota is exceeded
- Try disabling and re-enabling sync
Enable detailed logging by opening the browser console (F12) on any page. You'll see:
- URLs being checked for matches
- Which rules are being tested
- Match results and redirect decisions
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: rayhanshafi7@gmail.com