在实时服务器中设置 Zend 项目 [英] Set up zend project in live server
问题描述
其实我已经在 000webhost.com 免费主机上创建了帐户,我成功上传了系统.但我只能通过这个链接 aubergeikaze.netne.net/public/运行它.服务器基于Apache:
Actually, I have created account in 000webhost.com free hosting, I uploaded system successfully. But I am able to run it only through this link aubergeikaze.netne.net/public/. The server is based on Apache:
//////////////////////.htaccess file \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /
/////////////////////////////////////////////////////////////////////
如何将 http://aubergeikaze.netne.net/public/ 配置为
How can I configure http://aubergeikaze.netne.net/public/ to http://aubergeikaze.netne.net/ server in Apache. Thanks
推荐答案
本质上,您需要在根文件夹中有一个 index.php
和一个 .htaccess
文件,因为这是 Apache 提供服务的地方.
Essentially, you need an index.php
and a .htaccess
file in the root folder as that's where Apache is serving from.
index.php:
<?php
define('RUNNING_FROM_ROOT', true);
include 'public/index.php';
.htaccess:
SetEnv APPLICATION_ENV production
RewriteEngine On
RewriteRule .* index.php
您还需要理清 CSS 和 JS 文件等静态资产的路径.您可以更改路径以包含 public/
或为您编写插件.
You'll also need to sort out the paths to static assets like CSS and JS files. You can either change the paths to include public/
or write a plugin to to it for you.
对此答案的评论中指出的另一个选项(此处格式化以方便阅读):
Another option as noted in the comments to this answer (formatted here for readability):
使用以下内容在根文件夹中创建一个 .htaccess 文件:
Create an .htaccess file into root folder with this content:
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php
这篇关于在实时服务器中设置 Zend 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!