301 Redirect Code Generator
Use permanent 301 redirect to preserve search engines rank.
The code generator supports web pages redirection of html, php,
asp, aspx files and .htaccess redirect.
Redirect options
| Redirect type |
Redirect side |
Old page file type |
Old URL server type |
Is permanent 301 redirect? |
| PHP |
Server-side |
.php |
Apache / Linux |
yes |
| ASP |
Server-side |
.asp |
IIS / Windows |
yes |
| ASP.NET |
Server-side |
.aspx |
IIS / Windows |
yes |
| .htaccess |
Server-side |
all |
Apache / Linux |
yes |
| IIS |
Server-side |
all |
IIS / Windows |
yes |
| HTML meta tag |
Client-side |
.html |
all |
no |
Send feedback!
Please help to improve this page by sending suggestions /
problems to feedback at rapidtables.com.
Please send also your URL and server type information (Apache/IIS/PHP/ASP version numbers), if possible.
';
}
else if( type == 3 ) // .htaccess
{
txt = '# Permanent URL redirect - generated by www.rapidtables.com\n';
txt += 'Redirect 301 ';
url = T1.value;
i = url.indexOf("//");
if(i>0)
url = url.substring(i+2);
i = url.indexOf("/");
if(i>=0)
url = url.substring(i);
else
url = '/';
txt+= url;
txt+= ' ';
txt+= T2.value;
txt+= '\n';
}
//else if( type == 4 ) // html canonical link tag
//{
// txt = '\n\n';
// txt+= '\n';
// txt+= '\n\n\n\n';
//}
else // html meta tag
{
txt = '\n\n';
txt+= '\n';
txt+= '\n\n\n\n';
}
document.getElementById('TA1').value = txt;
}
function ResetButton()
{
T1.style.color = "#aaa";
T2.style.color = "#aaa";
}
function ResetText(obj, op)
{
if( op==0 ) // onclick
{
if( (obj==T1 && obj.value==old_url)||(obj==T2 && obj.value == new_url) )
{
obj.value = "";
obj.style.color = "#000";
}
}
else // onblur
{
if( obj.value == "" )
{
if( obj==T1 )
obj.value = old_url;
else
obj.value = new_url;
obj.style.color = "#aaa";
}
}
}
function SetFocus()
{
calc.input.focus();
}
function load()
{
Downloadify.create('downloadify',{
filename: function(){
c1 = document.getElementById('C1').selectedIndex;
if( c1==3 )
name = '.htaccess';
else
{
name = document.getElementById('T1').value;
name = name.substring(name.lastIndexOf('/')+1);
}
return name;
},
data: function(){
return document.getElementById('TA1').value;
},
//onComplete: function(){ alert('Your Redirect Code Has Been Saved!'); },
//onCancel: function(){ alert('You have cancelled the saving of this file.'); },
//onError: function(){ alert('You must press the Generate button first!'); },
onComplete: function(){},
onCancel: function(){},
onError: function(){},
swf: '../../dcneiner-Downloadify-8b1d240/media/downloadify.swf',
downloadImage: '../../dcneiner-Downloadify-8b1d240/images/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});
}
//-->
|