Redirecting to an "under construction" page
Hi, I need all URLs of a Zope site to be temporarily redirected to an "under construction" page. http://www.foo.com/any/path?any=query --> http://www.foo.com/underconstruction_html I've tried through an access rule script but it seems that the request.RESPONSE.redirect(...) doesn't work in that case. Any idea ? Many thanks in advance. -- Gilles Lenfant Pilot Systems - 66, rue de Provence - 75009 Paris Tel : +33 1 44 53 05 55 - www.pilotsystems.net Hébergement Zope et Plone gratuit - http://www.objectis.org
At 11:01 AM 12/9/2003, Gilles Lenfant wrote:
Hi, I need all URLs of a Zope site to be temporarily redirected to an "under construction" page. http://www.foo.com/any/path?any=query --> http://www.foo.com/underconstruction_html
1. Use VirtualHostMonster to point www.foo.com domain traffic to a different folder within Zope. Works well on naked Zope if you use the mapping settings. 2. Rewrite the URLs for www.foo.com in your Apache directives if you run Zope behind Apache. 3. In designing your site, consider using a common header file that every page aquires... use it when you need to add something (like a redirect) across your whole site. In the old days this might be <dtml-var standard_html_header>. I like #1 and #2 better overall - point traffic away from your site, and create subdomain test.foo.com for your development purposes. Then when it's ready, repoint foo.com and www.foo.com toward the materials you have finished. =Paul
There's another, simpler approach. Write a simple server and use it rather than Zope. YMMV depending upon your site configuration. Something like this should do the job... #!/usr/bin/env python2 import SimpleHTTPServer import SocketServer import StringIO message = '''<HTML> <HEAD><TITLE>Announcement</TITLE></HEAD> <BODY> <center> <table width=300><tr><td> <tr><td> <center><h1>Under Construction</h1></center><p> <h2>Please accept our appologies for any inconvenience.</h2> </p> </td></tr> </table> </center> </BODY> </HTML> ''' PORT = 80 class MyHTTPRequestHandler( SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): """Serve a GET request.""" f = StringIO.StringIO(message) if f: self.copyfile(f, self.wfile) f.close() Handler = MyHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler ) print 'serving at port ', PORT httpd.serve_forever() On Tue, 9 Dec 2003, Paul Howell wrote:
At 11:01 AM 12/9/2003, Gilles Lenfant wrote:
Hi, I need all URLs of a Zope site to be temporarily redirected to an "under construction" page. http://www.foo.com/any/path?any=query --> http://www.foo.com/underconstruction_html
1. Use VirtualHostMonster to point www.foo.com domain traffic to a different folder within Zope. Works well on naked Zope if you use the mapping settings. 2. Rewrite the URLs for www.foo.com in your Apache directives if you run Zope behind Apache. 3. In designing your site, consider using a common header file that every page aquires... use it when you need to add something (like a redirect) across your whole site. In the old days this might be <dtml-var standard_html_header>.
I like #1 and #2 better overall - point traffic away from your site, and create subdomain test.foo.com for your development purposes. Then when it's ready, repoint foo.com and www.foo.com toward the materials you have finished.
=Paul
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Gilles Lenfant wrote at 2003-12-9 17:01 +0100:
I need all URLs of a Zope site to be temporarily redirected to an "under construction" page.
http://www.foo.com/any/path?any=query
-->
I would use an Apache Rewrite Rule for this...
I've tried through an access rule script but it seems that the request.RESPONSE.redirect(...) doesn't work in that case. Any idea ?
Use "raise 'Redirect', location" instead. -- Dieter
participants (4)
-
Dennis Allison -
Dieter Maurer -
Gilles Lenfant -
Paul Howell