Enter the destination URL
Paste the new absolute URL (https://…) and set a delay if you need meta refresh or JS redirects.
301 Redirect Code Generator on CalculatorX—clear steps, local browser calculation, and no account required. Runs locally in your browser. Try it free.
Loading tool…
Paste the new absolute URL (https://…) and set a delay if you need meta refresh or JS redirects.
Click Generate to build code for PHP, ASP/ASP.NET, .htaccess, IIS, HTML, or JavaScript.
Paste into the old page or server config, then verify with an HTTP status check for a true 301.
Version 1.0.0 · Engine tested
Server 301: Location header / Redirect rule → destination; Client: meta refresh or JS navigation after delayEnter a destination URL and optional delay, then generate copy-paste snippets for server or client redirects.
| Type | Side | File type | 301 support |
|---|---|---|---|
| PHP | Server | .php | Yes |
| ASP | Server | .asp | Yes |
| ASP.NET | Server | .aspx | Yes |
| Apache .htaccess | Server | All | Yes |
| IIS web.config | Server | All | Yes |
| HTML meta refresh | Client | .html | No |
| JavaScript | Client | .html | No |
| jQuery | Client | .html | No |
| Domain changed | Server changed | Place code on |
|---|---|---|
| No | No | Old page, same server |
| No | Yes | Old page, new server |
| Yes | No | Old page, same server |
| Yes | Yes | Old page, old server |
For .htaccess redirects, add rules to the .htaccess file or httpd.conf in the site root.
<?php
header("Location: http://www.example.com/new-page.php", true, 301);
exit();
?>
Redirect 301 /old-page.html http://www.example.com/new-page.html
<meta http-equiv="refresh" content="0; url=http://www.example.com/new-page.html">
Key distinctions behind the tool.
Use PHP, .htaccess, or IIS for permanent SEO-friendly HTTP 301 redirects. Use HTML or JavaScript only when you cannot change server config.
Yes. With .htaccess, Redirect 301 / https://newdomain.com/ sends the whole site to the new origin.
Open the HTTP status checker and confirm a 301 response with the expected Location header.
Yes. Enter https:// URLs for destinations. Prefer server-side 301 for HTTP→HTTPS upgrades.