In my bootstrap.php
我有以下内容:
if($_SERVER['SERVER_NAME'] == 'localhost')
Kohana::$environment = 'development';
else
Kohana::$environment = 'production';
...
switch(Kohana::$environment)
{
case 'development':
$settings = array('base_url' => '/kohana/', 'index_file' => FALSE);
break;
default:
$settings = array('base_url' => '/', 'index_file' => FALSE);
break;
}
In .htaccess
拥有这个:
# Installation directory
RewriteBase /kohana/
这意味着,如果我只是上传我的 kohana 应用程序,它就会崩溃,因为 RewriteBase 中的.htaccess
文件将会出错。有没有办法可以在.htaccess
文件类似于我在引导程序中的文件,以便它将使用正确的 RewriteBase?
我认为没有办法有条件RewriteBase
。在 Apache 中,我想到的唯一方法是将RewriteBase
指令转化为<Location>
标记,但仅在 httpd.conf 本身中可用,而在 .htaccess 文件中不可用。
在这种情况下我通常做的是定义一个不同的访问文件名 http://httpd.apache.org/docs/2.0/mod/core.html#accessfilename例如在本地环境中htaccess.txt
。该文件将包含本地重写规则,而.htaccess
包含服务器端的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)