Hide script extension
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 hos开发者_开发技巧ted 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.
Try this:
RewriteEngine On
RewriteRule ^/test/$ /test.py
Absolutely. Use mod_rewrite
to rewrite the URL as desired.
精彩评论