The HTTP response status code 301 Moved Permanently indicates a permanent redirect, which means that any existing links or records utilizing the URL for which this response is returned should be updated.
A range of methods exists for redirecting users from one domain or webpage to another, with 301 redirects being the type of HTTP redirect that is both user-friendly and search engine-friendly.
Here are all the options for setting up a domain forward or redirect:
- Plesk Domain alias (can optionally be applied to DNS, Web, and Mail)
- Plesk Domain Forwarding (can forward domain to any URL, applies only to Web)
- Redirecting any URL to any URL using custom web server directives or code (applies only to Web)
Redirect with Domain Alias
If you are forwarding a complete domain to another (like mydomain.com to mynewdomain.com), you can achieve this in Plesk by adding it as a domain alias — Plesk will automatically set up a 301 redirect for you.
- Log into Plesk and click the Add Domain Alias button
- Input the domain you wish to forward and then select the domain you want to forward it to
- Keep all checkboxes at their default settings. If you do not wish to forward mail, uncheck the “Mail Service” box.
- Click the OK button to save your changes
Redirect with Domain Forwarding
- Log into Plesk
- In Websites & Domains, click Add Domain:
- Select the appropriate webspace (subscription) name in the Webspace section where the forwarder needs to be set up and specify the forwarder domain name in the Registered domain name section:
- Select Forwarding in the Hosting type section:
- In the Forwarding Settings box, enter the destination address to which you wish to redirect visitors. Under Forwarding type, select Moved permanently (code 301)
- Click Add Domain.
Redirect with Web Server Config
You may use the following lines below as examples for configuring the redirection for your domain's web server.
Nginx redirect
- Log into Plesk and select “apache and nginx settings” under the domain you wish to add the redirect.
- Scroll down to the “Additional nginx directives” box
- Input your preferred version from the following options in the box and click Apply or OK.
# Simple path to path redirect: rewrite ^/source_path$ https://www.destination.com/new_path permanent; # Regex redirect to redirect *all* content from one domain to another: rewrite ^/(.*)$ https://www.destination.com/$1 permanent;
Apache/.htaccess redirect# Redirect everything: RewriteEngine on RewriteCond %{REQUEST_URI} !^.well-known/acme-challenge RewriteRule ^(.*) https://yournewsite.com$1 [R=301,L]
# Redirect specific pages (use this OR the everything rule above, NOT BOTH): redirect 301 / http://yournewsite.com/ redirect 301 /oldpage/ http://yournewsite.com/newpage/ redirect 301 /oldpage.html http://yournewsite.com/newpage/