301 and 302 Redirects
Redirect individual pages permanently or temporarily, to a path or a full URL.
Generate .htaccess redirect rules for Apache: 301 and 302 page redirects, www or non-www, HTTP to HTTPS and trailing slashes. Copy the code or download a ready file.
Rules are combined to avoid double redirects, and you get clear notes on what each one does.
The .htaccess file is a configuration file used by the Apache web server (and LiteSpeed). Adding redirect rules to it lets you send visitors and search engines from an old address to a new one — after a page move, a redesign, a domain change or when you want one consistent version of your site.
A 301 redirect tells search engines the move is permanent so they pass the old page's signals to the new one; a 302 says it is temporary.
Redirect individual pages permanently or temporarily, to a path or a full URL.
Send all HTTP traffic to the secure version of your site.
Pick one canonical version of your domain, combined with HTTPS in a single hop.
Always add or always remove the trailing slash.
Valid Apache syntax with comments, plus warnings about order and prefix matching.
Rules are generated in your browser.
HTTPS, www or non-www and trailing slashes.
One per line: the old path, then the new path or URL.
Or download a ready .htaccess file.
Add it to your .htaccess and check the redirects.
Quick answers about using the MoSanKit Htaccess Redirect Generator.
Add them near the top of the .htaccess file in your site's root folder. On WordPress, put them above the "# BEGIN WordPress" block.
No. These rules are for Apache and LiteSpeed. Nginx and IIS use different configuration syntax.
A 301 is a permanent move — search engines transfer the old URL's ranking signals. A 302 is temporary and keeps the original URL indexed.
The Redirect directive matches the start of a path. Use specific paths, and place more specific rules before general ones.
Yes. When both are chosen they are combined into a single redirect, so visitors are not sent through two hops.
A mistake can take a site offline, so always keep a backup of the original file and test your changes immediately.
Explore more free SEO and website tools from MoSanKit.