The .htaccess file provides powerful per-directory configuration for Apache, including redirects, URL rewriting and access controls.
How do I set up a 301 redirect from an old page to a new one?
Enter the old path (e.g. "/old-page") and click "Generate" — the tool returns a ready Redirect 301 or RewriteRule for .htaccess along with an explanation of where to place it in the file.
What is the difference between a 301 and a 302 redirect?
301 means a permanent redirect — search engines pass link equity to the new address and update their index. 302 is a temporary redirect, and equity stays with the old URL. For a permanent site restructure, you almost always want 301.
Do .htaccess rules work on Nginx?
No, .htaccess is an Apache-specific mechanism (mod_rewrite). For Nginx, equivalent redirect rules need to be rewritten as server/location directives in the site's config file.
Types of .htaccess rules
| Rule | What it does | When to use |
|---|---|---|
| Redirect 301 | Permanent redirect, preserves SEO value | A page has moved permanently |
| Redirect 302 | Temporary redirect | A page is temporarily unavailable or under maintenance |
| RewriteRule (internal) | Rewrites the URL without a visible redirect | Clean URLs, internal routing |
| RewriteCond | Condition before a RewriteRule | Apply a rule only under certain conditions (User-Agent, domain, etc.) |