How to Create a 301 or 302 Redirect?
301 or 302 Redirect – When you are moving your site to a new domain or shortening the URLs of your web pages to make it more user-friendly or SEO-friendly. Perhaps, you want to temporarily or permanently force your web visitors to land on a specific web page . In such a case, you need to redirect your URLs so that your web visitors do not end up in the wrong place, and instead land on the correct web page. Further, you also need to tell the search engines’ (Google, Bing, and like) crawlers that your site or URL has moved, so that they can crawl it to display or rank it in their search results.
In this short write-up, we will show you how to redirect your entire site or just a web page permanently or temporarily for URL Redirection.
To permanently redirect your site or web page, you need to use 301 redirect and to temporarily redirect, use 302 redirect. Here is how you can do it:
301 or 302 Redirect Different Server :
If your site is on Windows Server
- Open the IIS from the menu. Or press Windows + R and type inetmgr
- In Connections pane, expand Sites
- Select your site
- Now, from the Home pane on the right, click HTTP Redirect
- Check the box “Redirect requests to this destination:”
- Enter the destination URL
- Select ‘Status code’ to Permanent (301) or Found (302)*
- Click Apply on the Task pane on the right to apply the redirection changes
*The HTTP/1.0 initially gave 302 a description phase ‘Moved Temporarily’
If your site in on Linux Server
- Create an empty text file with a text editor of your choice and save it as htaccess.txt
- Type in the following:
- Redirect 301/http://yournewdomain.com/ – (Redirects your entire site permanently)
- Redirect 302/http://yournewdomain.com/ – (Redirects your entire site permanently)
- Redirect 301/examplepage.htmlhttp://yournewdomain.com/examplepage1 – (Redirects examplepage.html to the new destination permanently)
- Redirect 302/examplepage.htmlhttp://yournewdomain.com/examplepage1 – (Redirects examplepage.html to the new destination permanently)
- Save the file
- Upload this file to the root directory of your old site and rename it to .htaccess
If you have WebHost Manager or cPanel
- Login to your cPanel
- Navigate to the Domains section
- Click on Redirects
- Choose the redirection Type
- Permanent (301)
- Temporary (302)
5. From the drop-down, select the domain name you wish to redirect
6. If you want to redirect only a single web page or directory, type in the existing path next to the drop-down
7. In the Redirects to field, enter the new URL with http:// or https://
8. Select the appropriate www. Redirection: option
9. Click Add to create the redirect
That’s it!
If you need help with 301 or 302 redirect, contact us. We are the leading web development company, providing quality .NET development, ASP.NET development, Kentico development PHP development, WordPress development, Magento development, and Joomla development among others.
For more information, contact us at sales@conceptinfoway.com. You can also get in touch with us by filling out a simple form here or by calling us at +91 98250 31415. Also, follow us on Facebook.