Browse all tools
301 redirect

.htaccess 301 Redirect: 8 Rules and a Free Generator

.htaccess 301 Redirect
Share this article

Frequently Asked Questions

How do I create a 301 redirect in htaccess?

Add a single line to the .htaccess file in your site root: Redirect 301 /old-page /new-page. For pattern based moves like forcing HTTPS, use RewriteRule with the [R=301,L] flag instead. Save the file, then test the old URL in a private browser window to confirm it lands on the new address with a 301 status.

Is a 301 redirect good or bad for SEO?

A 301 redirect is good for SEO when used correctly. It passes almost all of the old URL ranking signals to the new one, which is exactly what you want during a move. Problems only appear when you chain several redirects together or use a 302 by mistake, since a 302 keeps the old URL indexed.

How long does a 301 redirect take to work?

A 301 redirect works instantly for visitors the moment you save the file. Search engines take longer. Google usually needs a few days to a few weeks to fully transfer ranking to the new URL, depending on how often it crawls your site. The redirect itself is live right away, so no traffic is lost in between.

What is the difference between a 301 and 302 redirect?

A 301 is a permanent redirect and a 302 is temporary. A 301 tells search engines to move ranking to the new URL and forget the old one. A 302 tells them to keep the original URL indexed because it will return. Use 301 for permanent moves and 302 only for short term swaps like a sale page.

Does .htaccess work on Nginx?

No. The .htaccess file is an Apache only feature, and Nginx ignores it completely. On an Nginx server you add redirects to the server block instead, using a return 301 directive. If you are not sure which server you run, check your hosting panel or look for a Server line in the response headers.

Why is my htaccess redirect not working?

The most common causes are a missing RewriteEngine On line, rules placed in the wrong order, or a cached redirect in your browser. Apache reads rules top to bottom, so put specific rules above general ones. Always test in a private window, since browsers cache 301 redirects and can show stale results.

Written by

Founder and CEO of Pixellize.io, building AI-powered web tools and digital products with a focus on user experience and automation. M.Sc. Zoology, working at the intersection of technology, data analytics, and life sciences.

Scroll to Top