httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Sean Conner)
Subject Re: [users@httpd] Forcing a HTTP status code
Date Fri, 02 Sep 2005 21:56:29 GMT
It was thus said that the Great steve once stated:
> When performing maintenance on a server, I'd like to show a message
> but not have it cached by a proxy or indexed by a search engine. The
> best way I can see is to set a status code of 503 -- but there is no
> way to do it within an apache http.conf file. Any advice?

  If you don't mind the default Apache 503 status message, you can do:

	Redirect 503	/

  within the <VirtualHost> directive, <Directory> directive, or .htaccess. 
However, if you want a personalized 503 response code, it can be done, but
it's a bit more work.  For instance:

  DocumentRoot  /home/spc/blog/htdocs
  CustomLog     logs/ combined
  Redirect      503     /cgi-bin/
  Redirect      503     /index.html
  Redirect      503     /index.rss
  Redirect      503     /2005
  Redirect      503     /addentry.html

  ErrorDocument   400     /errors/400.shtml
  ErrorDocument   401     /errors/401.shtml
  ErrorDocument   402     /errors/402.shtml
  ErrorDocument   403     /errors/403.shtml
  ErrorDocument   404     /errors/404.shtml
#	...
  ErrorDocument	  503	  /errors/503.shtml

#      ...

  I can't simply use "Redirect 503 /" since then the customized error pages
won't show up, so I have to mask all the appropriate top level documents
(and directories) with the specific Redirect directives.

  You might also want to do "RewriteEngine off" for the domain as well (that
is, if you do use mod-rewrite) but that may end returning 404s for URLs that
would otherwise normally exist, but that's something to play around with
(the documentation for RewriteRule only mentions redirects).


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message