Do not include http://domain.com

Generated Code

Instructions: Paste this code at the top of your .htaccess file located in your website's root directory (usually public_html).

About the HTACCESS Redirect Generator

The .htaccess file is a powerful configuration file used by Apache web servers. It allows you to control how your server responds to requests, enabling functionality like redirects, security restrictions, and URL rewriting. However, writing the correct syntax manually can be risky; a single typo can take down your entire website (Error 500).

This tool generates the exact code you need for the most common tasks without requiring you to learn Apache syntax (RegEx). Whether you are migrating a page to a new URL, securing your site with SSL, or fixing canonical domain issues, this tool has you covered.

Types of Redirects

  • 301 Permanent Redirect: Use this when a page has moved forever. It passes 90-99% of "link juice" (SEO ranking power) to the new URL. This is the standard for site migrations.
  • 302 Temporary Redirect: Use this for maintenance or temporary moves. It tells search engines to keep the old URL in their index because the content will return.
  • Force HTTPS: Essential for modern security. It ensures that if a user types http://, they are automatically sent to the secure https:// version.

Frequently Asked Questions

Where do I put this code?

Copy the generated code and paste it into the .htaccess file located in your website's root folder (often named public_html or www). If the file doesn't exist, you can create a text file named exactly .htaccess (the dot is important).

Why isn't my redirect working?

Ensure that RewriteEngine On is present at the top of your file (our tool includes this for complex rules). Also, browsers cache redirects aggressively. Test your changes in an Incognito/Private window to see the immediate effect.

Can I create multiple redirects?

Yes. You can paste multiple Redirect 301 lines one after another in your file. For example:

Redirect 301 /old-page.html /new-page.html
Redirect 301 /services.html /products.html