301 redirect is a type of permanent redirect from one URL to another. 301 redirects users and search engines to a different URL than the one they have actually inserted in their browser.
# Creating a 301 Redirect Using .htaccess
1. Log in to Control Panel.
2. Go to .htaccess Editor.
3. Go to Direct Editor.
4. Click on Change to select in which directory you want to place the 301 redirects.
5. Add any one of the following given code snippets into your .htaccess file depending on the task that you want to perform :
1) Old to a 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]
It will Update “OLDDOMAIN” to the old domain that you want to redirect to and will update your “NEWDOMAIN” to the domain to which it is already redirecting.
2) Https Redirect :
RewriteEngine On RewriteCond %{HTTP_HOST} ^DOMAIN.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.DOMAIN.com/$1 [R=301,L]
It will Update the “DOMAIN” to the domain that requires the redirect from HTTP to HTTPS.
6. Click on Save.
Related: Learn to Redirect HTTP to HTTPS in WordPress with Simple Steps
#Creating a 301 Redirect Using IIS Administration Console
1. Log in to Control Panel.
2. Go to the IIS Administration Console.
3. Click on Change to choose the directory from where you want to redirect.
4. Expand the URL Redirects by clicking on the ‘+’ button.
5. In the URL text box, enter the URL that you want to redirect to.
6. Check the Permanent Redirect.
7. Click on Set Redirect.
That’s it!
Now, you have successfully created 301 redirects.
Also Read :
1)How Can I Create Different Types Of Web Redirects Through cPanel?
2) How To Set Multiple Redirects For Email Account From Plesk?