[mod_python] Rewriting urls and relative urls.

roy roy at 3mb.co.nz
Wed May 12 14:57:02 EDT 2004


Hello.
I need some help here please.
I am re-writing url on the server, but I have problem in the returning page with relative urls ( in links, images, etc..) 
The code to redirect:

from mod_python import apache
import urllib

def handler(req):
     opener = urllib.FancyURLopener({})
     f = opener.open("http://www.google.com/")
     x = f.read()
     req.write(x)

Now, the  browser sees the page but no images/links are displayed because of wrong url.
it looks something like:
 "<img src="original url/Images/x.jpg>"
instead of:
 "<img src="google/Images/x.jpg>"

I do not want to redirect the browser as well.
any suggestions?
thanks
roy




More information about the Mod_python mailing list