Loading...

Knowledge Base

How To Do a 301 or 302 Redirect to a Website for Plesk

A website redirection is generally done so that when mydomainA.com is accessed, you are routed to the website content for mydomainB.com. You can have a 301 permanent redirect or a 302 temporary redirect.

 

What Is 301 vs 302 Redirect

A 301 redirect is done when you have permanently moved your website to a new address, which is your new domain name. This permanent redirection also tells search engines, e.g. Google, that you are moving from point A to point B for good. In return, search engines will allow direct ranking and value signals for the new URL, understanding that this is now the permanent home of your website content.

On the other hand, a 302 redirect is done for temporary reasons, e.g. in cases where you are doing major maintenance for your main website and you would like to temporarily route your website visitors to a different site. This will avoid visitors from receiving an error page while your main website is currently down. Search engines will know that you have only done a temporary redirection and that the value of that page should be kept intact and should not be transferred or indexed along with the other URL.

 

How To Create a 301/302 Redirect for Addon Domains & Subdomains

Both types of redirection can be done for your addon domains and subdomains with Plesk by following these simple steps:

  1. Access your Hosting Manager.
  2. Click Websites & Domains from the left-side menu.
  3. Look for the domain or subdomain you would like to manage.
  4. Under that domain or subdomain, click on the Hosting Settings icon.
  5. Click on the Change link for the Hosting type setting.
  6. On the Change Hosting Type page, click on the drop-down menu and select Forwarding.
  7. Enter the complete URL of the target website.
  8. Select the Forwarding type you prefer and click OK.
  9. A pop-up warning will appear, click Yes if you agree.
 

How To Create a 301/302 Redirect for Your Primary Domain

The primary domain name is directly hosted by your Windows Hosting and is directly connected to your Plesk panel. Both types of redirection can be done for your primary domain name using a script that you can add to your web.config file in Plesk. Refer to the instructions below to know how:

  1. Access your Hosting Manager.
  2. Click Websites & Domains from the left-side menu.
  3. Under the primary domain name, click on the File Manager icon.
  4. Click on the httpdocs folder from the left-side panel under Home directory.
  5. Look for the web.config file and click on it to open.
    You can also click on the menu icon to the right of the file and select Edit in Code Editor from the drop-down list.
  6. Add the following script to redirect an entire directory to a new location, replacing http://domain.com with the URL of the target website:
     

    NOTE: Remember to save a backup copy of the file before making any changes.

    For 301 redirect:
     
    <?xml version="1.0"?>
      <configuration>
        <system.webServer>
          <httpRedirect enabled="true" destination="http://domain.com/newdir" httpResponseStatus="Permanent" />
        </system.webServer>
      </configuration>
    For 302 redirect:
    <?xml version="1.0"?>
      <configuration>
        <system.webServer>
          <httpRedirect enabled="true" destination="http://domain.com/newdir" httpResponseStatus="Temporary" />
        </system.webServer>
      </configuration>
  7. Click OK to save.
 

You have just learned how to do a 301/302 redirection for your primary domain on Plesk.

If you need assistance in setting up your 301 or 302 redirect for your Windows Hosting, please don't hesitate to contact us.

Did you find this article helpful?

 
* Your feedback is too short

Loading...