Htaccess Redirect Generator

Search Engine Optimization
Welcome to SEOSiteKit

Htaccess Redirect Generator


1. Select redirect type





2. Digite seu nome de domínio


Do not include www. Domain name only - e.g. yourdomain.com

3. Get your code


4. Copy the code to your .htaccess file



Welcome to SEOSiteKit

Sobre Htaccess Redirect Generator

Generate Redirect Rules Without Touching a Single Line of Code

You changed a page URL, moved your site to HTTPS, or want to send visitors from an old domain to a new one. Writing redirect rules by hand means memorizing syntax and hoping you do not take your whole site offline with a typo. This Htaccess Redirect Generator builds the exact rule you need based on what you enter into a simple form. It is for site owners, web developers, and anyone on an Apache server who needs a redirect to work correctly the first time.

Choose the type of redirect you need, enter the old and new URLs, and the tool outputs the properly formatted code. Copy it into your .htaccess file and you are done.

How to Use the Htaccess Redirect Generator

  1. Select the type of redirect you need.
    Choose from common options like a 301 permanent redirect for pages that have moved forever, a 302 temporary redirect for short-term changes, or a redirect that forces all traffic from HTTP to HTTPS. The type you choose affects both how browsers and search engines handle the redirect. For permanent URL changes, always use 301.
  2. Enter the old URL path.
    Type the page or path you want to redirect from. This is the address visitors will no longer see. You can redirect a single page, an entire directory, or your whole domain. The tool formats the rule based on what you enter.
  3. Enter the new destination URL.
    Type the full address where visitors should land instead. This can be a page on your own site or a completely different domain. Make sure the destination URL is live and correct before implementing the redirect.
  4. Generate and copy the redirect code.
    Click the generate button. The tool outputs the properly formatted rewrite rule or redirect directive. Copy the entire line of code and paste it into your .htaccess file in the root directory of your website. Test the redirect in a browser to confirm it works.

Why .htaccess Redirects Matter

An .htaccess file is a configuration file used by Apache web servers. It sits in your website's root directory and controls how the server behaves for requests to your site. Redirects are one of the most common uses for .htaccess. When you change a URL, delete a page, or move your site to a new domain, a redirect tells the server to automatically send visitors and search engines to the correct location.

The difference between redirect types matters. A 301 permanent redirect tells search engines to transfer all ranking authority from the old URL to the new one. A 302 temporary redirect keeps the authority with the old URL because the move is not permanent. Using the wrong type can confuse search engines and hurt your rankings. The generator removes the risk of syntax errors. One missing space or misplaced character in a manual redirect rule can break your entire site. The tool produces clean, tested code that you paste in and trust.

How It Works

The tool formats your input into valid Apache mod_rewrite or mod_alias syntax, depending on the redirect type you select. For mod_rewrite rules, it generates RewriteRule directives with the appropriate flags and regular expression patterns. For simpler redirects, it generates Redirect or RedirectMatch directives. The generated code follows the standard syntax that Apache servers expect in .htaccess files.

Practical Example

You redesign your website and change your about page from /about-us.html to /about. You want anyone who visits the old URL to land on the new one, and you want search engines to transfer the page's ranking to the new address. You select a 301 permanent redirect, enter /about-us.html as the old path, and enter /about as the new destination. The generator outputs the redirect rule. You paste it into your .htaccess file and upload it. Now anyone visiting the old URL is seamlessly sent to the new one, and search engines update their index accordingly.

FAQ

What is an .htaccess file?

An .htaccess file is a configuration file used by Apache web servers. It allows you to control server behavior on a per-directory basis without modifying the main server configuration. Common uses include URL redirects, password protection, custom error pages, and blocking specific IP addresses.

What is the difference between a 301 and a 302 redirect?

A 301 redirect tells browsers and search engines that a page has moved permanently. Search engines transfer ranking signals to the new URL. A 302 redirect indicates a temporary move. Search engines keep the original URL indexed and do not pass full ranking authority to the destination. Use 301 for permanent changes and 302 only when the move is truly temporary.

Can a mistake in my .htaccess file break my website?

Yes. A single syntax error in an .htaccess file can cause your entire site to return 500 Internal Server errors and become inaccessible. That is why a generator is useful. It eliminates the risk of manual typos. Always back up your existing .htaccess file before making changes, and test your site immediately after implementing new rules.

Do I need an .htaccess file to set up redirects?

On Apache servers, .htaccess is the most common method for setting up redirects. If your site runs on Nginx, IIS, or another web server, .htaccess files will not work, and you need to use that server's specific configuration syntax. The generator is designed for Apache servers.

Can I redirect my entire domain to a new domain?

Yes. This is one of the most common uses for .htaccess redirects. The generator can create a rule that captures all requests to your old domain and redirects them to the corresponding pages on your new domain. This is essential when rebranding or migrating your site.

Where should I place the .htaccess file?

Place the .htaccess file in the root directory of your website, usually called public_html, www, or htdocs depending on your hosting setup. Redirect rules apply to the directory where the file is located and all subdirectories below it unless overridden by another .htaccess file in a subdirectory.

Related Tools