Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Trying to redirect every urel request to script with thevisitors page request as url parameter.

Thread Tools

Trying to redirect every urel request to script with thevisitors page request as url parameter.

Posts: n/a
Hello guys! This is my first post in this group!
I'am trying to create a python script to take a visitors page request
as url parameter, and the insert or update the counters database table
and the render the template(my tempalets are actually html files) that
has int hem special strign identifies format charactes so to replace
them with actual data form within my python script.

While the mod_rewwrite redirects okey

when i try to apache by default tries to open
idnex.html file right?

but due to

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+) /cgi-bin/$1 [L,PT]

redirectes the url to script and i expect it to give to my
pythoin script the initial url before the mod_rewrite as a URL

while i tested and my script works ok(its a simple test cghi script
afgter all)

when i enable out mod_rewriute code within the htaccess file i get an
Internal Server Error

You can see if you try to

whiel if i disbale mod_rewrite code my script work proiducing

That leads me to beleive that the intiial requests never passes as url

my python script is this simple script:

# -*- coding: utf-8 -*-

import cgitb
import os, sys, socket, datetime

print ( "Content-type: text/html\n" )

# get some enviromental values
if os.environ.has_key('HTTP_REFERER'):
page = os.environ['HTTP_REFERER']
page = "tipota"

host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
date = '%y-%m-%d %H:%M:%S' )

print page, host, date

Can you help please?
Also i want the code to redirect to only if the initial
request is a .html page not with every page.

Thanks again!
Reply With Quote
Jason Friedman
Posts: n/a
2010/7/20 <(E-Mail Removed)>:
> Hello guys! This is my first post in this group!

I do not have an answer to your question, other than to suggest you
look at (and/or post) relevant lines from Apache's access.log and

I write mostly to say that, in my experience, folks on this list are
very helpful, but your post has many, many spelling errors, making it
difficult to read. It looks like you are using Gmail, which has a
"Check Spelling" drop-down on the compose window. If you re-post with
better spelling you might get more responses.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Explorer.exe error report every time access every type of video me =?Utf-8?B?SXJ3YW5zeWFo?= ASP .Net 4 10-30-2007 07:49 AM
redirect on every request Paul ASP .Net 3 07-05-2007 03:13 PM
Malformed URL by using Page.Request.Url.ToString() - why? =?Utf-8?B?QXhlbCBEYWhtZW4=?= ASP .Net 3 04-18-2007 06:45 AM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM