ESC

Rule Configuration

Quick Presets
Add Rule
Rule List (0)
No rules added yet. Use presets or add rules manually.

Generated Output

Add rules to generate server configuration...
Add rules to generate server configuration...
Add rules to generate server configuration...
All processing happens in your browser. No data is sent to any server. Always test generated rules in a development environment before deploying to production.

Usage Examples

E-commerce SEO Setup

Force HTTPS, redirect www to non-www, and add trailing slashes. Essential SEO configuration for e-commerce websites.

Blog Migration

Redirect old blog URLs to new article paths. Preserve SEO value when restructuring your website content.

Security Hardening

Block hotlinking, restrict access by IP address, and set up custom error pages for better security.

Features

Multi-Server Support

Generate rules for Apache (.htaccess), Nginx, and IIS (web.config) from a single configuration

Quick Presets

One-click presets for common scenarios like HTTPS redirect, www handling, and trailing slashes

Rule Management

Add, edit, delete, and reorder rules with an intuitive drag-and-drop style interface

Privacy First

All processing happens locally in your browser, no data is sent to any server

How to Use?

1

Add Rules

Use quick presets or manually add redirect and rewrite rules with source, destination, and optional conditions.

2

Choose Server Type

Switch between Apache (.htaccess), Nginx, and IIS (web.config) tabs to see the generated output for your server.

3

Copy or Download

Copy the generated configuration to your clipboard or download it as a file ready to deploy.

Frequently Asked Questions

A redirect sends the browser to a different URL — the address bar changes and the browser makes a second HTTP request to the new location. A rewrite remaps the URL internally on the server: the browser never sees the change, the address bar stays the same, and only one HTTP request is made. Use redirects when pages have moved permanently or temporarily. Use rewrites to serve clean, friendly URLs from internal file paths — for example, showing /products/shoes while the server actually serves /index.php?category=shoes.

Use 301 (Permanent) when a page has moved for good and you want search engines to transfer all SEO ranking signals (link equity) to the new URL. Use 302 (Found/Temporary) or 307 (Temporary Redirect) when the redirect is short-lived and you plan to bring the original URL back. Caching is the key difference: browsers and CDNs cache 301s aggressively, so if you ever need to undo the redirect, users may still be sent to the old destination for a long time. When in doubt, use 302 until you are sure the move is permanent.

Use the "HTTP to HTTPS" quick preset. For Apache it generates a RewriteRule that matches all requests where HTTPS is off and redirects to the https:// version with a 301. For Nginx it creates a server block on port 80 that returns a 301 to the HTTPS equivalent. For IIS it adds an HTTP Redirect rule in web.config. After applying the rule, verify your SSL certificate is installed and valid before deploying — an HTTPS redirect without a working certificate will break your site.

Use the "www to non-www" or "non-www to www" preset. Apache uses a RewriteCond on HTTP_HOST to detect the www prefix and redirects with a 301. Nginx uses a separate server block that matches www.yourdomain.com and returns a 301 to the non-www version. Whichever you choose, pick one and stick to it — mixing both means Google sees the same content at two URLs, which splits ranking signals. Set your canonical URL to match your redirect target.

Yes. Toggle "Use regular expression" when adding a rule and enter a regex pattern in the Source URL field. For Apache, patterns are PCRE-compatible regex matched against the URL path. For Nginx, the location directive uses PCRE regex with the ~ prefix. For IIS, the match directive uses .NET regex. Captured groups are available as backreferences ($1, $2 in Apache/Nginx) in the destination URL. For example, source /blog/([0-9]+) with destination /news/$1 moves all old numeric blog URLs to /news/.

Apache processes RewriteRules from top to bottom and stops at the first matching rule (unless the [L] flag or RewriteRule chain changes this). If you have a general rule before a specific one, the general rule catches requests that should have been handled by the specific one. Always put more specific rules first. For example, put /old-page → /new-page before /(.*) → /index.php, otherwise all URLs including /old-page get caught by the wildcard rule first.

Yes. The Download button exports the currently visible config tab as a file with the correct name for your server: .htaccess for Apache, nginx.conf for Nginx, or web.config for IIS. The file downloads to your default Downloads folder. Place the .htaccess file in your website root directory (the same level as index.php or index.html). For Nginx, merge the generated directives into your existing server block configuration.

No. Everything runs locally in your browser with JavaScript. Your source URLs, destination URLs, and generated configurations are never sent to any server. There are no accounts, no history, and no tracking. Close the tab and the rules are gone — use the Download button to save your work before leaving.

What is a Rewrite Rule Generator?

If you have ever stared at .htaccess syntax wondering why your redirect is not working, this tool is for you. It takes the guesswork out of writing rewrite rules by letting you configure redirects visually and then spitting out correct config for Apache, Nginx, or IIS. No more copy-pasting from Stack Overflow and hoping for the best.

Key Features

You get one-click presets for the stuff everyone needs: HTTP-to-HTTPS, www handling, trailing slashes, domain moves. For anything custom, just add your source pattern and destination, toggle regex if needed, and the tool generates all three server formats at once. You can reorder rules, edit them inline, and export the final config as a downloadable file.

Common Use Cases

Site migrations are the big one. When you restructure URLs or move domains, you need clean 301 redirects so search engines follow along. E-commerce sites use it to enforce HTTPS and canonical URLs. Security-conscious admins use it to block hotlinking or restrict access by IP. Basically, if your web server needs URL rules, this tool handles it.

Tips for Better Rules

Always use 301 for permanent moves and 302 for temporary ones. Order matters in Apache, so put more specific rules first. Test your generated config in a staging environment before pushing to production. And if you are migrating a large site, add rules incrementally rather than all at once.

Privacy and Security

Everything runs in your browser. Your URLs, patterns, and server config never leave your machine. There is no server-side processing, no accounts, no tracking of what you generate. Just open the tool and start building your rules.

Security and Privacy

Your data security is our priority

Local Processing

All processing happens in your browser

No Data Transfer

Your data is not sent to our servers

No Data Storage

No data is stored or shared

SSL Encryption

SSL encryption for secure connection

Also on MoreOnlineTools