Mobile app version of vmapp.org
Login or Join
Lee4591628

: Redirect visitors when site is too busy We're expecting a large spike in traffic to our website this week. If the site becomes overloaded (i.e. visitors are getting a 503 error), I want to

@Lee4591628

Posted in: #Error #Redirects #Server #WebDevelopment #WebHosting

We're expecting a large spike in traffic to our website this week. If the site becomes overloaded (i.e. visitors are getting a 503 error), I want to redirect visitors to another web address. How would I go about doing this?

10.05% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

5 Comments

Sorted by latest first Latest Oldest Best

 

@Shelley277

I will suggest to go for multi servers to solve this issue , where servers are connected in clustred format . So in case server load of one goes high your traffic is diverted to second server and so on

10% popularity Vote Up Vote Down


 

@Gloria169

There are things you can do at a number of levels:

Network Level


Network Hardware: Install a load-balancer, with addition servers behind it. This will allow you to run your existing set-up fairly easily, but will probably cost quite a lot of money to setup in the time frame you have (depending on your hosting providers support levels)
Virtual Hardware: Move to a cloud based system with load-balancing built in. This will give you the benefits of option 1, without the potentially hefty setup costs with your hosts (you only pay for what you use), however this may take time on your side to set up.


These are probably the "best" options for dealing with this, and are very tried and trusted, but they do come at a financial cost - especially for point 1.

However, they can both be configured to handle your "worst case" scenario of "Our servers can't cope" - the loadbalancers can be configured to route all traffic to a server that just holds a flat page saying the site is currently down, but here's a bit of information.

Software Level

In addition to the methods laid out in the other answers, most servers allow you to set up error pages in a number of ways - typically these are a page on the site, however you should also be able to issue a redirect to a page on a different server as well.

In IIS for example you can create an error response that "Responds with a 302 redirect" - this can be a URL on a completely different server - you can do this at the .net error page level or the IIS error level:

.net

<customErrors mode="RemoteOnly">
<remove statusCode="503" />
<error redirect="htp://www.example.com/sitedown.html" statusCode="503" />
</customErrors>


IIS

10% popularity Vote Up Vote Down


 

@Radia820

If you are using apache: Search your root folder for the file named "htaccess.txt" or ".htaccess". Add the following line:

ErrorDocument 503 www.example.com/customhtml.html

You have your visitors redirected to customhtml.html. You can add an iframe of your "another web address" in the HTML code.

10% popularity Vote Up Vote Down


 

@Si4351233

It seems like you're aiming for the second-worst outcome. If you're expecting a spike, you have time to do something:


Implement in-code caching (can be easy, can take a while to get right)
Optimise static files (jpegoptim, optipng, more-css, etc) to reduce bandwidth, speed things up for all users.
Move your static stuff to a CDN to remove those requests from your network completely.
If it's all static, copy the site to a few more computers and use a load balancer to keep the site up under one IP. Sounds expensive but many VPS providers will give you a setup like that for about a week.
Or look at CloudFlare (et al) front-end caching services. Even a novice can implement these in minutes but it won't help much alone if you have a highly dynamic site.


Just get things ready so that you know that if things break down, you've done everything to make sure those users get what they wanted the first time around. Planning to fail isn't a bad practice but look at the options to avoid failing in the first place!

But yes, the best standard option (which you should have implemented already) is to customise your error pages so that people know something wrong is going on. I should point out that most people react very negatively to these. If the message is "please come back later" expect only a fraction of a fraction to return.

So again, this is an ideal opportunity to revisit how the site is hosted and if nothing else have a [practised] plan to swap over to better hardware within an hour of failure.

10% popularity Vote Up Vote Down


 

@Chiappetta492

When your website is too busy due to a large traffic, the best way of redirection is using custom error documents. So, when a user gets 503 error code, the server will redirect visitors to the custom error document page you have defined.

There are different ways for different servers to customize error document pages.

1. For Apache server, add the following code in .htaccess file.

ErrorDocument 503 example.com/maintenance.html

2. For IIS 7 server, add the following code in web.config

<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="503" />
<error statusCode="503" responseMode="Redirect"
path="http://example.com/maintenance.htm" />
</httpErrors>
</system.webServer>


Ref. CustomError in web.config

3. For Tomcat 7 server, add the following code in WEB-INF/web.xml file.

<error-page>
<error-code>503</error-code>
<location>/Error.jsp</location>
</error-page>

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/Error.jsp</location>
</error-page>


Ref. Custom Error Page in Tomcat 7

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme