Forum

Thread tagged as: Question, Problem, Error

Path issue

Hi guys,

I have an issue that I can't resolve.

My site path was automatically added in my config.localhost.php files as the following:

define('PERCH_SITEPATH', '/Users/jacklinwood/Desktop/WORK/websites');

I added /wadhams_homes to the end as this is where my files are and clicked republish on the pages.

I would then click View Page on one of the pages in the backend and it would go to the root rather then /wadhams_homes

I think this is the reason that the perch content isn't showing on the pages it's supposed to and is instead creating new pages in the backend.

Any ideas?

Thanks,

Jack

Jack Linwood

Jack Linwood 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Were the pages created before you moved your site into a subfolder?

Hi Drew,

The site had been previously made in Perch Runway by someone else and I have the files to work on it locally. I downloaded a new install of Perch Runway and added the existing database and templates. The files are in a subfolder called /wadhams_homes

Here is my config.php file:

<?php
    switch($_SERVER['SERVER_NAME']) {

        case 'localhost':
            include(__DIR__.'/config.localhost.php');
            break;

        default:
            include('config.production.php');
            break;
    }

    define('PERCH_LICENSE_KEY', 'removed');
    define('PERCH_EMAIL_FROM', 'jack@vrve.co');
    define('PERCH_EMAIL_FROM_NAME', 'Jack Linwood');

    define('PERCH_LOGINPATH', '/wadhams_homes/admin');
    define('PERCH_PATH', str_replace(DIRECTORY_SEPARATOR.'config', '', __DIR__));
    define('PERCH_CORE', PERCH_PATH.DIRECTORY_SEPARATOR.'core');

    define('PERCH_RESFILEPATH', PERCH_PATH . DIRECTORY_SEPARATOR . 'resources');
    define('PERCH_RESPATH', PERCH_LOGINPATH . '/resources');

    define('PERCH_HTML5', true);
    define('PERCH_TZ', 'UTC');

And here is my config.localhost.php file:

<?php

    define('PERCH_SITEPATH', '/Users/jacklinwood/Desktop/WORK/websites');

    define('PERCH_SCHEDULE_SECRET', '95Cra1oSB0uMoIbb');

    define('PERCH_DB_USERNAME', 'root');
    define('PERCH_DB_PASSWORD', 'root');
    define('PERCH_DB_SERVER',   "localhost");
    define('PERCH_DB_DATABASE', 'wadhams_homes');
    define('PERCH_DB_PREFIX',   'perch3_');
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you move the site into a subfolder then none of the paths will match the paths already in use. If you want to get the existing site up and running, you should keep the relative paths within the site the same.

I'm not sure I understand.

My problem isn't internal linking to each page. My site is showing in the subfolder and is accepting perch content but is trying to create new pages in the backend rather than showing me the existing. When I click View Page on an existing page in the backend it takes me to the root rather than my subfolder. Surely there is a setting in the core files that can add the subfolder to the relative links? Because it isn't me that is creating these links, it's Perch.

Any ideas Drew?

I need to make a start on this today.

Drew McLellan

Drew McLellan 2638 points
Perch Support

My site is showing in the subfolder and is accepting perch content but is trying to create new pages in the backend rather than showing me the existing.

Runway sees those new paths as new pages because they don't match the paths in the site as it stands.

Long and short: if your site wasn't created in a subfolder (it wasn't) don't try and put it into one now.