Re: [users@httpd] Forcing a HTTP status code

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

 



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:

<VirtualHost 66.252.224.11>
  ServerName    work.flummux.org
  ServerAdmin   sean@xxxxxxxxxx
  DocumentRoot  /home/spc/blog/htdocs
  CustomLog     logs/work.flummux.org 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

#      ...
</VirtualHost>

  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).

 -spc


---------------------------------------------------------------------
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