- Plesk for Linux
- Plesk for Windows
How can the option "Permanent SEO-safe 301 redirect from HTTP to HTTPS" be set for all domains in Plesk?
There is no way to set an SEO-safe redirect for all domains via Plesk Interface.
However, this can be set at Service Plan level for all subscriptions assigned to the service plan.
Go to Service Plan > Plan name > Hosting Parameters > Permanent SEO-safe 301 redirect from HTTP to HTTPS
Click Update & Sync
Note: in case there is Hosting Settings Management Permission is enabled in the corresponding service plan, then such kind of setting will not be synced, because permission to manage it was given to the end user. In this situation, proceed with the command line resolution below.
In order to add SEO-safe redirect for all domains, it is possible to use the command line utilities fetching domains list from the database. For that:
- Log into the server via SSH.
- Get the list of all domains assigned to a service Plan that has SSL enabled. In the example below, 'Default Domain' service plan is used:
# plesk db -Ne'select domains.name from domains, hosting, Subscriptions, PlansSubscriptions, Templates where domains.id=hosting.dom_id AND Subscriptions.object_id=domains.id AND PlansSubscriptions.subscription_id = Subscriptions.id AND PlansSubscriptions.plan_id=Templates.id and Templates.name="Default Domain" and hosting.ssl="true";' > domains.txt
- Use this list in a script to enable SEO-Safe redirect:
# for i in `cat domains.txt`; do plesk bin domain -u $i -ssl-redirect true; done
- Restart Apache in order to apply the change:
# service httpd restartOR
# service apache2 restart