【发布时间】:2014-09-20 16:31:15
【问题描述】:
我正在尝试在子域上部署 Fat Free Framework 应用程序。它在我的本地服务器上运行良好,但是在将其部署到实时站点的子域上时,我得到了一个空白页面。我相信我的配置(.htaccess,config/routes)错误,但我尝试了几个,但无法让它工作。我的配置是:
.routes 文件
[routes]
GET /games/@gameid/@move = WebPage->getgames
.config 文件
[globals]
AUTOLOAD = app/;third_party/;third_party/phpQuery/
DEBUG = 0
UI = views/
ENCODING = utf-8
LOGS= tmp/cache/
.htaccess 文件
#mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L,QSA]
#Hotlinking Protection
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?subdomain.domain.com/.*$ [NC]
RewriteRule \.(js|css|jpg|gif|png|bmp|mp4|3gp|m4a|m4r|aac|mp3|ogg|wave)$ - [F]
#PHP code in HTML file
AddType fcgid-script .php .htm .html .phtml
我使用的是 PHP 版本 5.3.28 Apache 2.3.7
文件夹结构
subdomain.domain.com(子域文件夹)
- .htaccess 文件
- index.php 文件
- 应用文件夹
- db 文件夹
- 查看文件夹
- 第三方文件夹
- tmp 文件夹
在我的本地服务器上,我有这样的 .htaccess 文件
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L,QSA]
【问题讨论】:
-
您本地服务器上的
.htaccess文件是什么?这似乎是错误的:RewriteBase /subdomain.domain.com. -
是的,正如 JakeGould 所说,我已将 .htaccess 文件编辑为 \,但在尝试访问 subdomain.domain.com/games/01test20140322/1 时仍会出现空白页。 .htaccess 文件与 index.php 文件位于子域文件夹中。包含我的配置和路由的应用程序文件位于 /subdomain/app 下方的文件夹中
-
你能提供它工作的 URL 以及它工作的 .htaccess 吗?否则几乎没有人可以帮助您。
-
就像我之前所说的,它可以在我的本地服务器上运行(在虚拟主机上,而不是子域上)。我不知道我是否正确回答了您的问题,但我试图重现上面的文件夹结构。唯一的更正是我的子域文件夹在我的网络主机文件中被命名为 subdomain.domain.com
-
您向我们展示了不起作用的配置,但是在您的本地设置上确实有效的配置是什么?具体来说,您在本地主机上成功访问的 URL 是什么?在本地主机上工作的
.htaccess是什么?
标签: php .htaccess subdomain fat-free-framework