【发布时间】:2016-07-24 03:53:57
【问题描述】:
我在 Python/Flask 中创建了一个简单的应用程序,它有一个主页 url (www.site.com/)。我已经获得了一个 HostGator 共享帐户来托管它,所以我只能访问 .htaccess,但没有其他 Apache 配置文件。
我设置了一个 FastCGI 脚本来运行应用程序(在 these instructions 之后),但它们要求 URL 具有 /index.fcgi 或任何其他路径。 我可以让 FastCGI 脚本直接提供根路径 (/) 吗? 另外,像 /static/ 和 /favicon.ico 这样的文件夹应该由 Apache 提供。
我现在拥有的.htaccess 是:
AddHandler fcgid-script .fcgi
DirectoryIndex index.fcgi
RewriteEngine On
RewriteBase /
RewriteRule ^index.fcgi$ - [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.fcgi/$1 [R=302,L]
我不确定,但我认为 Apache 版本是 2.2。
【问题讨论】: