首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kohana部署

kohana部署
EN

Stack Overflow用户
提问于 2009-12-11 03:55:20
回答 3查看 614关注 0票数 0

我正在部署我的站点,使用kohana,这是测试站点-localhost/koh,我使用htaccess删除索引。我可以成功地把它放在像www.site.com/koh这样的地方,但我正在努力把它放在根文件夹中,并使它与htaccess一起工作,或者我如何使它工作,通过将索引放在根目录中并将所有其他文件保存在koh文件夹中?有人能帮上忙吗?谢谢

EN

回答 3

Stack Overflow用户

发布于 2009-12-11 15:13:13

这是你问题的答案:

Kohana Deployment outside the root and more

票数 1
EN

Stack Overflow用户

发布于 2011-10-26 01:27:54

假设您运行的是v3...这些步骤应该会让你走上正确的方向:

将index.php放在您想要运行Kohana的文件夹中(在您的示例中,是根公共html文件夹)。

在index.php中,确保$application、$modules和$system的路径正确。(它们可以是绝对的或相对的(相对于index.php的位置)。)例如,要使您的应用程序文件夹恰好位于webroot之上,您可以使用"../ application ",依此类推,用于模块和系统。

在bootstrap.php中,检查base_url是否针对您的环境进行了适当设置(将其设置为"/")。

最后,确保.htaccess中的RewriteBase也设置为"/“。

票数 0
EN

Stack Overflow用户

发布于 2011-11-19 00:18:59

在您的示例中,索引文件应该是这样的,并放在根文件夹下:

代码语言:javascript
复制
/**
 * The directory in which your application specific resources are located.
 * The application directory must contain the bootstrap.php file.
 *
 * @see  http://kohanaframework.org/guide/about.install#application
 */
$application = './koh';

/**
 * The directory in which your modules are located.
 *
 * @see  http://kohanaframework.org/guide/about.install#modules
 */
$modules = './koh/modules';

/**
 * The directory in which the Kohana resources are located. The system
 * directory must contain the classes/kohana.php file.
 *
 * @see  http://kohanaframework.org/guide/about.install#system
 */
$system = './koh/system';

查看我下面的htaccess,看看你的htaccess应该是什么样子。我的是example.htaccess的修改版本。强制301重定向到uri,没有尾随的斜杠。

以下是我为Kohana构建部署的方式。它允许多个应用程序使用一组核心文件。

代码语言:javascript
复制
www/
  apps/
    web/
      cache/
      classes/
      config/
      logs/
      media/
      messages/
      pub/
        index.php
        .htaccess
        robots.txt
  lib/
    modules/
    system/

这是我修改后的.htaccess

代码语言:javascript
复制
# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

RewriteCond %{REQUEST_URI} (.*)$
RewriteRule ^(.+)/$ /$1 [R=301,L]

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b - [F,L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

下面是index.php中的相关行

代码语言:javascript
复制
/**
 * The directory in which your application specific resources are located.
 * The application directory must contain the bootstrap.php file.
 *
 * @see  http://kohanaframework.org/guide/about.install#application
 */
$application = '../';

/**
 * The directory in which your modules are located.
 *
 * @see  http://kohanaframework.org/guide/about.install#modules
 */
$modules = '../../../lib/modules';

/**
 * The directory in which the Kohana resources are located. The system
 * directory must contain the classes/kohana.php file.
 *
 * @see  http://kohanaframework.org/guide/about.install#system
 */
$system = '../../../lib/system';

注意:此设置要求您配置web服务器以访问每个应用程序。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1883547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档