This 301 redirect generator turns old and new URLs, one pair or a whole migration list, into clean rules for Apache and LiteSpeed servers, with an Nginx version too. It flags loops, duplicates and chains before the code reaches your .htaccess file.
Sends every http:// request to the same address on https://. The .htaccess rule works for any domain on the server.
Keeps the path, so /page/ on one version opens /page/ on the other.
Back up .htaccess first, paste the rules above # BEGIN WordPress, then open an old URL in a private window. If the site shows error 500, restore the backup.
Nginx does not read .htaccess. Add these blocks to the server configuration and reload Nginx.
A 301 redirect is a server response that tells browsers and search engines a page has moved permanently to a new address. Google treats it as a strong signal to index the new URL and passes ranking signals to it. The status code is defined in RFC 9110 as “Moved Permanently”.
On most hosting you set redirects in the .htaccess file, which Apache and LiteSpeed servers read, including most cPanel plans. Nginx ignores .htaccess, so this 301 redirect generator also prints the same rules in Nginx syntax with return 301.
To create a 301 redirect in .htaccess, back up the file, generate the rules, paste them above the WordPress block and test an old URL. The whole job takes a few minutes.
# BEGIN Ideluma redirects to # END Ideluma redirects, at the top of .htaccess. WordPress rewrites everything between its own markers, so rules placed inside them get lost.If the site shows error 500 after saving, restore the backup at once: one typo in .htaccess stops the whole site, and the copy brings it back in seconds. The generator writes the rules but can’t see how your server answers, so always open a few old URLs after the change.
Use 301 for any page or site that moved for good, and 302 only for a temporary move. 307 and 308 do the same jobs while keeping the request method, which matters for forms and APIs.
NameMoved Permanently
Permanent?Yes
Keeps request methodNot guaranteed
Use it whenA page or site moved for good. The standard SEO redirect
NameFound
Permanent?No
Keeps request methodNot guaranteed
Use it whenTemporary move: A/B test, maintenance, seasonal page
NameTemporary Redirect
Permanent?No
Keeps request methodYes
Use it whenTemporary move of forms or APIs that use POST
NamePermanent Redirect
Permanent?Yes
Keeps request methodYes
Use it whenPermanent move of forms or APIs
Google describes how it treats each type in Redirects and Google Search. A temporary code keeps the old URL in the index, so choose 302 only when the page is really coming back.
These six rules cover most redirect tasks. The 301 redirect generator writes the same code with your addresses, inside its # BEGIN and # END markers.
A single page moves to a new address:
# One page to another
Redirect 301 /old-page/ https://example.com/new-page/
Every http:// request goes to https:// on the same host:
# HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Visitors on www.example.com land on example.com with the same path:
# www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
The site moves to a new domain and every path stays the same:
# Old domain to new domain, keeping paths
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$ [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]
A folder moves and every page inside it follows:
# Whole folder to a new folder
RedirectMatch 301 ^/blog/(.*)$ https://example.com/articles/$1
An address with a query string goes to a clean URL:
# Page with a query string (?id=12) to a clean URL
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=12$
RewriteRule ^product\.php$ https://example.com/product-name/? [R=301,L]
Redirect and RedirectMatch never see the part after ?, so an address with a query string needs RewriteCond %{QUERY_STRING} and RewriteRule, as in the last rule. The ? at the end of the new URL drops the old parameters.
A bulk 301 redirect generator handles a whole redirect map at once: switch to Bulk, paste one old and one new URL per line, or open a CSV file exported from a spreadsheet.
Redirect also catches every address under a path, so the tool places longer paths first and tells you.When the whole domain changes, add the domain rule too and report the move in the Change of Address tool in Google Search Console.
Most redirect problems come from a few repeated mistakes, and each one either wastes crawling or loses the page’s ranking signals.
Redirect ignores query strings, so /product.php?id=12 needs a rewrite rule.The .htaccess file works on Apache and LiteSpeed servers, which covers most cPanel hosting, and has no effect on Nginx.
location blocks go inside the existing server block; domain rules are separate server blocks.Add a line such as Redirect 301 /old-page/ https://example.com/new-page/ to the .htaccess file in your site root, above the WordPress block. The 301 redirect generator writes this line for you, adds rewrite rules where needed and checks the list for loops and duplicates.
A 301 redirect says a page moved permanently, so search engines index the new URL and pass ranking signals to it. A 302 says the move is temporary, so the old URL stays in the index. Use 302 only for tests, maintenance or seasonal pages.
No. A 301 redirect is the method Google recommends when a URL changes, and it passes ranking signals to the new address. Losses come from chains, loops, redirects to unrelated pages and removing redirects too soon, which the warnings in this tool help you avoid.
Keep 301 redirects for at least a year after a move, as Google advises for site migrations, and longer if old links still bring visitors. Removing them early turns every old link, bookmark and search result into a 404 page.
Put them at the top of the file, above the line # BEGIN WordPress. WordPress rewrites the section between # BEGIN WordPress and # END WordPress when permalinks are saved, so any rule placed inside that section disappears.
A loop happens when a URL redirects to itself or two rules point at each other, and the generator warns about both. Error 500 usually means a typo or a directive the server doesn’t support: restore the backup, then paste the generated block again without editing it by hand.
No. Nginx does not read .htaccess files, so rules placed there have no effect. Switch the generator to Nginx, add the location or server blocks to your Nginx configuration and reload the server. Apache and LiteSpeed do read .htaccess.
Choose HTTP to HTTPS in the generator and paste the rule into .htaccess: it sends every http:// request to the same address on https://. Install the SSL certificate first, otherwise visitors land on a security warning instead of your page.
Choose Old domain to new domain, enter both domains and paste the rule into the .htaccess file of the old site. Every path keeps its place, so old-domain.com/page/ opens new-domain.com/page/. Then report the move in Google Search Console.
Yes. Switch to Bulk and paste one old and one new URL per line, separated by a space, tab or comma, or open a CSV file. There is no limit on the number of lines, and the generator checks the whole list for duplicates, loops and chains.
Browsers cache 301 redirects, often for a long time, so your own browser may keep following an old rule after you change it. Test in a private window or clear the cache. Visitors who never opened the old URL get the new rule at once.
The 301 Redirect Generator is part of the free SEO toolkit on Ideluma. Check the snippet of a moved page with the SERP Simulator, or compare the old and new .htaccess with Text Compare.