douzhi7451 2015-02-01 17:46
浏览 32
已采纳

页面不存在错误

I am trying to install a script called JobberBase but un-successfully... The problem is that my home page loads normally but when I click any links, it just says that the page doesn't exist... Here is a live example: http://onboardcloud.com This is my config file:

<?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.');
}
?>

And this is my .htaccess file:

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]

I am using Ubuntu as a server. I installed Apache2, PHP, MySQL, suPHP and PHPmyAdmin. Any help would be appreciated!

  • 写回答

1条回答 默认 最新

  • doutuan8887 2015-02-01 21:37
    关注

    I don't know jobberbase but your htaccess file should look something like this.

    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>
    

    And this below is supposed to be in your Apache vhost config file. On Ubuntu it's in /etc/apache2/sites-available/default. If not default, then whatever you called your site in the sites-available directory. If it's already there then no need to change anything, just make sure AllowOverride is set to All

    <Directory /var/www/>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       allow from all
     </Directory>
    

    Then make sure to restart apache if you update the vhost file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示