1

I am facing the following problem and need a correct solution also for SEO purposes.

It happens that our server, which is on a shared hosting, fails and responds with a 503 server error code. What I have done now is setup IIS on another server to allow the requests from that particular domain. It contains 1 page with some details to our customers about the problem. It is some kind of maintenance page.

On the DNS records I now edit the IP to that new server where the maintenance page is located.

This is now visible to our customers but what will Google do now? The 503 server error is now gone and is now a 200 status code because of the new server.

How can I still throw the 503 server error on the new server so that Google knows its a temporarely error?

1

How can I still throw the 503 server error on the new server

Using whatever server-side scripting language you are using. For example, in PHP this would be something like:

header('HTTP/1.1 503 Service Unavailable',true,503);

Note that if you are serving a (temporary) 503 then it is advisable to also send a Retry-After header with the time the service is expected to return.

Although you wouldn't normally need to set up an alternative server to serve this "maintenance page" unless the primary server had catastrophically failed (unusual for a shared server)? You would also likely experience a delay as the DNS propagates. You should be able to setup a custom error document on most servers to serve the appropriate message under these conditions.

  • I was first looking at that solution but the custom error documents are only available till error code 502. That's it, no custom error document can be set for code 503. – Mivaweb Jun 15 '15 at 8:56
0

First of all what @w3d suggested is also a good solution I have done it in another way.

On the backup server I have added some url rewriting in the IIS in order to redirect all pages, except the maintenance page, using a 302 redirect to that maintenance page.

Rewrite rule

    <rewrite>
      <rules>
        <rule name="Maintenance" stopProcessing="true" enabled="true">
          <match url="^(.*)$" ignoreCase="false"/>
          <conditions logicalGrouping="MatchAll">
            <add input="{URL}" pattern="/maintenance.aspx$" ignoreCase="false" negate="true"/>
            <add input="{URL}" pattern="/css/(.*)$" ignoreCase="false" negate="true"/>
            <add input="{URL}" pattern="/js/(.*)$" ignoreCase="false" negate="true"/>
            <add input="{URL}" pattern="/images/(.*)$" ignoreCase="false" negate="true"/>
          </conditions>
          <action type="Redirect" url="/maintenance.aspx" redirectType="Found"/>
        </rule>
      </rules>
    </rewrite>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.