开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜