Scripting: How to Create a 301 Redirect
Stuck? Call us at %%SupportPhone%% to have our %%CorporateShort%% Professional Services set up 301 redirect for a small service fee.
How to Create a 301 Redirect Using .htaccess
Important: You can also manually edit and upload a .htaccess file by using FTP.
- Log in to your %%CorporateShort%% Control Panel.
- Go to .htaccess Editor.
- Go to Direct Editor.
- Click Change to select which directory you want to place the 301 redirect in.
- Add one of the following code snippets into your .htaccess file (based on what you want to do):
Old to new domain RewriteEngine on RewriteCond %{HTTP_HOST} ^OLDDOMAIN.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.OLDDOMAIN.com [NC] RewriteRule ^(.*)$ http://NEWDOMAIN.net/$1 [L,R=301,NC]
Update "OLDDOMAIN" to the old domain you want to redirect to and update the "NEWDOMAIN" to the new domain it is redirecting to. Https Redirect RewriteEngine On RewriteCond %{HTTP_HOST} ^DOMAIN.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.DOMAIN.com/$1 [R=301,L]
Update the "DOMAIN" to the domain that requires the redirect from HTTP to HTTPS - Click Save.
How to Create a 301 Redirect Using the IIS Administration Console
Important: The IIS Administration Console is only available on Windows hosting accounts.
- Log in to your %%CorporateShort%% Control Panel.
- Go to IIS Administration Console.
- Click Change to choose which directory you want to redirect from.
- Expand URL Redirects by clicking on the '+' button.
- In the URL text box, enter the URL you want to redirect to.
- Check Permanent Redirect.
- Click Set Redirect.
Will adding a 301 Redirect conflict with some of my existing websites
Some website builders preconfigure .htaccess settings that may conflict with the implementation of a 301 Redirect. If you are uncertain of how to properly implement your 301 redirect code, please contact us or call %%SupportPhone%% and ask about our Professional Services.