2016-12-09 1 views
0

私はCentOS上でCGIとして動作するFlaskアプリを持っています。 cgiスクリプトはindex.cgiです。index.cgiをindex.pyに書き換えます

ここで、index.cgiをindex.pyにします。

私はこのようになる人々にいくつかのURLを与えている...

https://anysite.com/errorlog/index.cgi/search_body_request/?startdate=2016-01-01&enddate=2016-12-31&srchtxt=Persistence+error

は、どのように私は彼らににindex.cgiを含むURLをindex.pyするにindex.cgiを書き換えることができ代わりにindex.pyにルーティングされますか?

私のサーバーからindex.cgiを削除し、代わりにindex.pyを使用したいと思います。

答えて

0

私はそれを解決ように見えます...

このフラスコアプリはメインのhtdocsフォルダオフエラーログという名前のフォルダにあります。 ここは私がやったことですが、今はうまくいくようです。

Options +ExecCGI +FollowSymLinks 
AddHandler cgi-script .cgi .py .rb 

RewriteEngine On 
# Lets rewrite all request to https... 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

# Lets rewrite all request containing index.cgi to /errorlog/index.py 
RewriteRule ^index.cgi?(.*)$ /errorlog/index.py$1 [L] 

# Lets rewrite all request to the errorlog folder with requested file not found to /errorlog/index.py 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ /errorlog/index.py/$1 [QSA,L] 

私は理由を知りたがっています! 私はそれが動作すると思うようにコメントしました...

誰かが簡単に私に教えてくださいどのようにこの作品!

関連する問題