Search code examples
plesk

How to disable 301 redirection in plesk for Domain-Alias via API


I using https://example.com:8443/enterprise/control/agent.php to call plesk Api using some Xml content, what I do is create and manage my domains and sites. For some reason I need Create a Site-Alias(domain-alias) for my domain without 301 redirection.I can do it from plesk panel as I note in Image attached. But I don't know how to set it with xml. This my xml that I post via API :

<packet version="1.6.7.0">
  <site-alias>
    <create>
      <pref>
        <web>1</web>
        <mail>0</mail>
        <tomcat>0</tomcat>
      </pref>
      <site-id>104</site-id>
      <name>mysub.myotherexample.com</name>
    </create>
  </site-alias>
</packet>

Note that I have two domain name, example.com and myotherexample.com .I want add domain-alias mysub.myotherexample.com which is an alias for example.com.

I need some setting like what you see in Image.But my xml also enabled 301 redirection.

enter image description here


Solution

  • There is a seo-redirect option https://docs.plesk.com/en-US/17.0/api-rpc/reference/managing-site-aliases/site-alias-settings.33538/ :

    <packet version="1.6.7.0">
      <site-alias>
        <create>
          <pref>
            <web>1</web>
            <mail>0</mail>
            <tomcat>0</tomcat>
            <seo-redirect>0</seo-redirect>
          </pref>
          <site-id>104</site-id>
          <name>mysub.myotherexample.com</name>
        </create>
      </site-alias>
    </packet>