Mobile app version of vmapp.org
Login or Join
Samaraweera270

: Redirect to another server during a 503 server error 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,

@Samaraweera270

Posted in: #Redirects #Seo

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera270

2 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

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>

10% popularity Vote Up Vote Down


 

@Jamie184

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme