我正在尝试安装一个名为JobberBase但不成功的脚本... 问题是我的主页正常加载,但当我点击任何链接时,它只是说该页面不存在...这是一个实例:http://onboardcloud.com 这是我的配置文件:
<?php
/**
* Define environments
*
*/
// local
$__instances['local'] = array(
// The prefix should be a unique part of the url (not including protocol name or auth info; see below).
'prefix' => 'localhost',
// mysql credentials
'db_host' => 'localhost',
'db_port' => 3306,
'db_user' => 'root',
'db_password' => 'password',
'db_name' => 'jobberbase',
'db_prefix' => '',
// your site's full url
'app_url' => 'http://localhost/',
// language to use
'lang_code' => 'en',
// error reporting
'ini_error_reporting' => E_ALL,
'ini_display_errors' => 'On',
// environment setting 1 (use 'local' for localhost/testing OR 'online' for live, production environment)
'location' => 'online',
// environment setting 2 (use 'dev' together with 'local' in the previous setting OR 'prod' with 'online')
'environment' => 'prod',
//'apache_mod_rewrite', 'iis_url_rewrite' -microsoft URL Rewrite module, 'iis_isapi_rewrite'
'rewrite_mode' => 'apache_mod_rewrite'
);
// live
$__instances['live'] = array(
'prefix' => 'onboardcloud.com',
'db_host' => 'localhost',
'db_port' => 3306,
'db_user' => 'root',
'db_password' => 'password',
'db_name' => 'jobberbase',
'db_prefix' => '',
'app_url' => 'http://onboardcloud.com/',
// language to use
'lang_code' => 'en',
'ini_error_reporting' => E_ALL,
'ini_display_errors' => 'Off',
'location' => 'online',
'environment' => 'prod',
'rewrite_mode' => 'apache_mod_rewrite'
);
// http requests
if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI']))
{
$_compare_to = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
// setup current instance
foreach ($__instances as $__instance)
{
if (strstr($_compare_to, $__instance['prefix']))
{
define('DB_HOST', $__instance['db_host']);
define('DB_PORT', $__instance['db_port']);
define('DB_USER', $__instance['db_user']);
define('DB_PASS', $__instance['db_password']);
define('DB_NAME', $__instance['db_name']);
define('DB_PREFIX', $__instance['db_prefix']);
// values kind of redundant, they indicate wether this is a live/production or dev/testing environment
define('LOCATION', $__instance['location']);
define('ENVIRONMENT', $__instance['environment']);
$app_url = $__instance['app_url'];
$indexOfLastSlash = strrpos($app_url, "/");
$expectedIndexOfLastSlash = strlen($app_url) - 1;
// manually add an ending slash to the app_url if the user didn't specify it
if ($indexOfLastSlash && $indexOfLastSlash != $expectedIndexOfLastSlash )
$app_url .= '/';
// base url of the app
define('APP_URL', $app_url);
define('REWRITE_MODE', $__instance['rewrite_mode']);
// error reporting
ini_set('error_reporting', $__instance['ini_error_reporting']);
ini_set('display_errors', $__instance['ini_display_errors']);
define('LANG_CODE', $__instance['lang_code']);
break;
}
}
if(!defined('DB_HOST'))
{
die('None of the configured JobberBase instances matched your request!<br />If you are an admin of this JobberBase installation, you may want to review the \'prefix\' values of the configured JobberBase instances in config.envs.php.');
}
?>
这是我的.htaccess文件:
ErrorDocument 404 /page-unavailable/
<files ~ "\.tpl$">
order deny,allow
allow from all
deny from none
AllowOverride All
</files>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
我使用Ubuntu作为服务器。我安装了Apache2,PHP,MySQL,suPHP和PHPmyAdmin。 任何帮助将不胜感激!
答案 0 :(得分:2)
我不了解jobberbase,但你的htaccess文件看起来应该是这样的。
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
ErrorDocument 404 /page-unavailable/
<Files ~ "\.tpl$">
order deny,allow
deny from all
</Files>
以下内容应该在您的Apache vhost配置文件中。在Ubuntu上它是/etc/apache2/sites-available/default
。如果不是默认值,那么无论您在站点可用目录中调用您的站点。如果已经存在,则无需更改任何内容,只需确保将AllowOverride
设置为All
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
然后确保在更新vhost文件时重新启动apache。