views:

33

answers:

2

I have a html form that posts to a python script test.py. If someone tries to access the script directly, it redirects them to the form.

I not using a web framework, just straight python cgi programming. My website is hosted on a shared hosting provider that allows me access to a .htaccess file.

I wanted to know if there was a way to have the form post to the script and in the address bar show mydomain.com/test/ and not mydomain.com/test.py ?

Thanks.

+3  A: 

Try this:

RewriteEngine On
RewriteRule ^/test/$ /test.py 
Tomh
In `.htaccess` files you might have to omit the leading slash, I forget...
David Zaslavsky
and should the form post to just "/test"
Ali
+1  A: 

Absolutely. Use mod_rewrite to rewrite the URL as desired.

Ignacio Vazquez-Abrams