.htaccess Redirect Generator
Automatically generate 301/302 transfers, domain migrations, and URL normalization rules
with an intuitive GUI.
Generated .htaccess Code
You might also like
What is .htaccess Redirect?
This tool allows you to intuitively generate "301 redirect" rules from a GUI without requiring advanced technical knowledge. 301 redirects are essential for carrying over your SEO evaluations during URL changes caused by site renewals, domain migrations, or HTTPS (SSL) conversions. Simply paste the generated code into your server's `.htaccess` file, and it functions immediately.
All generation and text processing occur exclusively within your web browser. No sensitive data, such as your URLs or domains, is ever sent to or stored on an external server. It is completely secure and requires no registration to use.
How to Use
Select a Target Tab
Choose the tab that matches your goal: "Page/Dir Redirect" for specific pages, "Domain Migration" for full site moves, or "URL Normalization" for resolving www/HTTPS duplicate content.
Enter Old and New URLs
Input the previous path and the new target URL. Adjust the HTTP status code (301 or 302) as needed. The code snippet updates immediately as you type.
Copy and Install Code
Click the "Copy Code" button and paste the generated snippet near the top of your web server's `.htaccess` file, then save.
.htaccess & Redirect Glossary
- .htaccess
- A configuration file used by Apache web servers to manage directory-level settings. It is widely used for implementing URL redirects, controlling caching, and setting up password protection.
- 301 Redirect (Moved Permanently)
- An HTTP status code signaling that a page has "permanently" moved to a new location. It allows the new URL to inherit the SEO equity (PageRank) of the old URL, making it crucial for site renewals.
- 302 Redirect (Found)
- An HTTP status code indicating a "temporary" move. It is useful for site maintenance or temporary campaigns. Since it's temporary, search engines do not pass SEO value to the new URL.
- 410 Gone
- A status code meaning the target resource is "permanently gone" with no forwarding address. It signals search engines to swiftly remove the page from their index rather than trying to crawl it again.
- URL Normalization (Canonicalization)
- The practice of selecting the best, single URL when there are multiple choices (e.g., handling "www" vs "non-www", or HTTP vs HTTPS). This prevents duplicate content issues and consolidates SEO ranking.
- RewriteRule / RewriteCond
- Directives from Apache's `mod_rewrite` module. `RewriteCond` defines the condition (like checking if the request is not HTTPS), while `RewriteRule` dictates the actual URL rewrite action and status flags.
Frequently Asked Questions
- Q.Should I use 301 or 302?
- Always use '301' for permanent site renewals or domain migrations if you don't plan to return to the old URL. A 301 redirect passes SEO value to the new URL.
- Q.Can I use this with WordPress?
- Yes. However, to ensure it works without conflicts, insert the generated code near the top of your `.htaccess` file, specifically above the `# BEGIN WordPress` block that WordPress automatically generates.
- Q.Can I generate multiple redirects at once?
- Yes, under the 'Page/Dir Redirect' tab, click the 'Add Rule' button to generate multiple redirect settings simultaneously.
- Q.Does it work with Nginx servers?
- The code generated by this tool is exclusively for Apache `.htaccess` syntax. For Nginx servers, you must convert the rules into Nginx syntax and place them in your `nginx.conf`.
- Q.Are my entered URLs sent to or saved on a server?
- No. All code generation processing is done locally within your browser. Your entered data is never sent to or stored on any external server.
Use Cases
Site Renewals and Page Moves
When URL structures change during a site redesign, you can instantly generate a batch of 301 redirect rules mapping the old paths to the new ones, preventing traffic loss.
Domain Migration
When shifting your brand or service to a brand-new domain, this tool generates the correct rules to seamlessly forward your entire website to the new address while preserving inner directory paths.
Forcing HTTPS (SSL)
After acquiring an SSL certificate, you must force all outdated `http://` traffic to route securely through `https://`. Our generator provides the exact RewriteCond for secure routing.
Preventing SEO Dilution
By enforcing either a "www" or "non-www" structure, you ensure search engines do not index two identical versions of your site and penalize you for duplicate content.
Technical Specifications
Safe RewriteRule Generation Algorithm
This tool safely escapes all special characters within the paths and domains you input before generating the `.htaccess` code. For instance, dots in your domain name (e.g., `.com`) are automatically escaped (`\.`) to prevent regular expression misinterpretations.
Furthermore, when creating directory-level redirects, it correctly utilizes Apache's capture groups (`$1`) to ensure that all query parameters and underlying subdirectories are accurately transferred to the target destination.
Send Feedback
Please let us know your thoughts to help us improve the tool.
Feedback is temporarily suspended
The server is busy or spam protection is active. Please try again later.