Re: Mod Rewrite for Server Status 503, depending upon URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On September 16, 2011 2:58 , Ujjwal Kumar <ujjwal.kumar@xxxxxxxxxxxxxx> wrote:

  * /music is not a physical directory


What is /music? Is this URL proxied? Is the content for this URL generated by a script? Something else?


  * In one sentence, the problem is to redirect specific urls (a) to a
    page only if that specific url (a) has a 503 error.


The easiest way: 503 errors are not normal. Find what is causing the error and fix it. Alternatively, if the 503 error is being returned deliberately as a status by a script, modify the script so that the script does a 302 redirect instead (for example, to http://google.com/music)

Another way: set up an ErrorDocument on your server (not on google.com) to handle all 503 errors. Have this ErrorDocument be a CGI script or other active content. The script should examine the REDIRECT_* environment variables set up by Apache HTTP Server to determine which URL the user was requesting, and, if the user was requesting /music, the script should generate a 302 response to redirect the user to http://google.com/music If the user was not requesting /music, then the script should do whatever you want done in the case of a 503 error (display an error message for the user, etc.). For details, see https://httpd.apache.org/docs/2.2/custom-error.html

A harder way: Write an Apache HTTP Server module to do exactly what you want. An alternative to writing a module in C would be to use mod_perl: https://perl.apache.org/docs/2.0/user/handlers/http.html

I hope this helps.

--
  Mark Montague
  mark@xxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux