How to set SEO option Preferred Domain for all domains to None?

Created:

2016-11-16 12:54:38 UTC

Modified:

2017-04-24 12:07:56 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to set SEO option Preferred Domain for all domains to None?

Applicable to:

  • Plesk 11.5 for Windows
  • Plesk 12.0 for Linux

Symptoms

After upgrade to Plesk 11.5, domains are redirecting to the URL 'www.domain.com' , even if addressed without 'www' in browser.

Cause

This is caused by the new Preferred Domain feature, which is set to 'www.' by default for all installations.

Resolution

In order to switch off the feature, please follow either of the following instructions depending from your OS:

For Windows

  1. Run following command to retrieve list of domains with enabled SEO Redirect (it will require Plesk Panel admin password):

    "%plesk_dir%"\\mysql\\bin\\mysql.exe -uadmin -p -P8306 psa -Ne"select d.name from dom_param dp,domains d where dp.param='seoRedirect' and d.id=dp.dom_id and dp.val in ('www','non-www') order by d.id" > C:\\seo_dom_list.txt
  2. Create a C:\\seo_update.bat file using Notepad and add following lines there:

    @echo off
    for /f %%i in (c:\\seo_dom_list.txt) do ( echo %%i
    "%plesk_cli%\\subscription.exe" -u %%i -seo-redirect none)
  3. Launch the script file.

    C:\\seo_update.bat
    sub1.tld
    SUCCESS: Update of domain 'sub1.tld' completed.
    sub2.tld
    SUCCESS: Update of domain 'sub2.tld' completed.

For Linux

  1. Run following command by root or a user with root privileges:
    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -Dpsa -Ne"select d.name from domains d, dom_param dp where d.id=dp.dom_id and dp.param='seoRedirect' and dp.val in ('www','non-www');" |while read i;do /usr/local/psa/bin/subscription -u $i -seo-redirect none;done
    SUCCESS: Update of domain 'sub1.tld' completed.
    SUCCESS: Update of domain 'sub2.tld' completed.

Related articles

In order to disable the Preferred Domain for all newly created domains, please follow this article:

Have more questions? Submit a request
Please sign in to leave a comment.