Apache server : Get a virtual file distribute by a script

38 views Asked by At

My problem is the following : I have build an apache server (with python cgi). I have client that try to get a file like http://mysever/file (which is virtual, it does not exist). Depending of the user agent of the client I would like to serve a different file like http://mysever/type1/file or http://mysever/type2/file. I have tried with ScriptAlias file myscript.py ad I got error 403 Forbidden (my script has been chmoded +x) I have tried with with Script or Action and I got error 400 Bad Request. The only thing that works is with Redirect but it seems very ugly. Can you help me ?

Thank you ! :)

1

There are 1 answers

0
Megaman On

Okay, I have found the solution. In .htaccess file, in the <Directory> part, I have used :

RewriteEngine On
RewriteBase /
RewriteRule ^file$ myscript.py

Aaaaaaaand it's gone !