Free Online .htaccess Redirect Generator
Generate 301/302 redirect rules for Apache .htaccess files
Enter URL pairs above to generate redirect rules.
Try these next
Why use .htaccess Redirect Generator
- Web developers handling site migrations can generate hundreds of redirect rules from a spreadsheet of URL pairs in seconds using bulk import, avoiding hours of manual .htaccess editing.
- SEO consultants preserve their clients' search rankings during domain changes by generating correct 301 redirects that transfer link equity to the new URLs.
- WordPress site owners who lack server administration experience can create properly formatted .htaccess rules without memorizing Apache directive syntax.
- Freelancers save debugging time by generating rules with correctly escaped special characters instead of hand-writing regex patterns that often break silently.
- Content managers can cleanly remove old pages from search indexes using 410 Gone rules instead of leaving broken 404 errors that hurt site quality signals.
How it works
The generator takes pairs of old and new URLs and formats them as Apache .htaccess directives. In Redirect mode, it outputs simple Redirect directives with the status code, old path, and new URL on a single line. In RewriteRule mode, it wraps each pair in a RewriteRule with the old path converted to a regex pattern (special characters escaped), the new URL as the substitution, and flags like [R=301,L] that set the redirect status and stop further rule processing. The 410 Gone type always uses a RewriteRule with the [G,L] flag since the Redirect directive does not support the 410 status directly. The bulk import parser splits input by newlines, then separates each line by commas or tabs to extract old and new URL columns. All URL paths are trimmed, and RewriteRule patterns strip the leading slash because Apache matches against the path portion without it in per-directory .htaccess context.
About this tool
Generate .htaccess redirect rules for Apache web servers with this free online tool. Enter old and new URL pairs to create properly formatted 301, 302, 303, 307, or 410 redirect directives ready to paste into your .htaccess file. Website migrations, domain changes, and URL restructuring all require redirect rules to preserve search engine rankings and send visitors to the correct pages. A missing or misconfigured redirect means lost traffic, broken bookmarks, and wasted link equity that took months or years to build. This tool supports both simple Redirect directives and RewriteRule syntax with mod_rewrite, giving you flexibility depending on your hosting setup and requirements. Permanent 301 redirects tell search engines to transfer ranking signals to the new URL, while temporary 302 and 307 redirects preserve the original URL in search indexes. The 410 Gone status code signals that a page has been intentionally removed with no replacement. Web developers use this tool during site migrations to generate hundreds of redirect rules from a CSV or spreadsheet of old and new URLs using the bulk import feature. SEO consultants generate redirect maps for clients moving from one CMS to another. WordPress and cPanel users who manage their own hosting paste the generated rules directly into their .htaccess file through a file manager or FTP client. Freelance developers save time by avoiding manual .htaccess syntax that is easy to get wrong, especially when escaping special characters in URL paths. The output updates in real time as you type, and you can copy the entire .htaccess block with one click. All processing happens in your browser with no server interaction or account required.
How to use .htaccess Redirect Generator
- Enter your old URL. Type or paste the old URL path that should be redirected. Include the leading slash for relative paths or the full URL.
- Enter your new URL. Type or paste the destination URL where visitors should be sent. Use a full URL for external redirects or a relative path for internal ones.
- Select the redirect type. Choose 301 (permanent), 302 (temporary), 303 (see other), 307 (temporary strict), or 410 (gone) depending on your use case.
- Add more rules or use bulk import. Click 'Add Rule' to add more redirect pairs one at a time, or switch to Bulk Import to paste multiple old/new URL pairs from a spreadsheet.
- Copy and paste into .htaccess. Click Copy to grab the generated rules and paste them into your .htaccess file on your Apache web server.
Use cases
- A web developer migrating a client site from an old CMS to WordPress generates 200 redirect rules from an exported URL spreadsheet in under a minute.
- An SEO consultant auditing a website creates a redirect map to fix 50 broken backlinks found during a crawl, preserving domain authority.
- A marketing manager consolidating two microsites onto one domain uses bulk import to set up 301 redirects for all legacy landing pages.
- A content team removing discontinued product pages generates 410 Gone rules to signal search engines that the pages are intentionally deleted.
- A freelance developer sets up temporary 302 redirects during a website redesign so the client can preview the new site without losing current SEO rankings.
Frequently Asked Questions
A .htaccess file is a configuration file used by Apache web servers to control directory-level settings. It sits in your website's root directory (or any subdirectory) and can handle URL redirects, access control, custom error pages, MIME types, and caching rules. Changes take effect immediately without restarting the server. The filename starts with a dot, which makes it a hidden file on Unix-based systems.
A 301 redirect is permanent and tells search engines to transfer all ranking signals and link equity to the new URL. Use 301 when a page has moved permanently. A 302 redirect is temporary and tells search engines to keep the original URL in their index. Use 302 when the redirect is temporary, such as during maintenance or A/B testing. Using the wrong type can hurt your SEO rankings.
Use RewriteRule (mod_rewrite) when you need pattern matching, regular expressions, or conditional logic in your redirects. Simple one-to-one URL redirects work fine with the Redirect directive, which is easier to read and slightly faster for Apache to process. RewriteRule is necessary for complex scenarios like redirecting based on query strings, user agents, or when you need to rewrite URLs without a visible redirect.
A 410 Gone status tells search engines and browsers that a page has been intentionally and permanently removed with no replacement URL. Unlike a 404 (which suggests the page might return), a 410 explicitly signals permanent removal. Search engines will de-index the URL faster when they encounter a 410. Use this when you want to cleanly remove pages from search results rather than redirecting them.
Connect to your web server via FTP, SFTP, or your hosting control panel's file manager. Navigate to your website's root directory (usually public_html or www). If a .htaccess file exists, download it and add the generated rules. If it does not exist, create a new file named .htaccess (with the leading dot). Paste the redirect rules, save, and upload. Test your redirects immediately by visiting the old URLs in your browser.
Yes. Switch to Bulk Import mode and paste your old and new URL pairs separated by commas or tabs, one pair per line. You can export your URL mapping from a spreadsheet and paste it directly into the bulk input field. The tool generates all the redirect rules at once, saving significant time compared to writing each rule manually. Select the redirect type (usually 301 for migrations) before importing.
No. The .htaccess file and the Redirect and RewriteRule directives are specific to Apache web servers. Nginx uses a different configuration syntax in its server block files, and Microsoft IIS uses web.config with XML-based rewrite rules. If you are using Nginx or IIS, you will need to convert the generated rules to the appropriate format for your server.
A 307 Temporary Redirect is similar to a 302 but strictly preserves the HTTP method of the original request. When a browser receives a 307, it must use the same method (GET, POST, PUT, etc.) for the redirected request. A 302 technically allows browsers to change the method, though most modern browsers preserve it anyway. Use 307 when you need guaranteed method preservation, particularly for form submissions and API endpoints.
Related Tools
Discover more free utilities to enhance your productivity.