Forum

Thread tagged as: Question, Problem, Configuration

Sub-directories and file name conflicts with URL redirects

HI,

I'm trying to create a nested page structure where the sub-directories have the same name as the parent page. This would look like this for instance:

file = /open-programmes.php
sub-folder = /open-programmes/programme-name.php

I have the URL redirects on the top level pages working fine, but as soon as I want to create another level of pages with the same name structure I run into problems.

I've also tried putting an index.php file in the sub-directory instead, but this doesn't seem to work either. When I change the sub-directory folder name to something different from the file name it works, but this defeats the purpose of the file names and paths all being the same.

Please help, I'm a novice so please speak plainly :-)

Greg

Studio Daughter

Studio Daughter 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Create your file as:

/open-programmes/index.php

To do that in Perch, create a new page with the title "Open Programmes" and check the box that says the page will have more pages below it.

Thanks Drew,

I've done that, saved the pages as index.php and put them in sub-folders with the same name and altered the paths in the page details settings so that:

/open-programmes.php

is now

/open-programmes/index.php

This is now giving me a white screen. I'm changing the files manually and not through the interface. Anything else I'm missing? Would you need a diagnostic report?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

PHP Error log

[08-Jul-2015 22:17:51 Europe/Berlin] PHP Warning:  include(admin/runtime.php): failed to open stream: No such file or directory in /Users/Daughter-Greg/Code/neish_v2/open-programmes/index.php on line 1
[08-Jul-2015 22:17:51 Europe/Berlin] PHP Warning:  include(): Failed opening 'admin/runtime.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.5.10/lib/php') in /Users/Daughter-Greg/Code/neish_v2/open-programmes/index.php on line 1
[08-Jul-2015 22:17:51 Europe/Berlin] PHP Fatal error:  Call to undefined function perch_layout() in /Users/Daughter-Greg/Code/neish_v2/open-programmes/index.php on line 3
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Your runtime include is incorrect, you need to update it to include the file at the correct path if you are in a subdirectory. So ../admin/runtime.php not admin/runtime.php.

Bingo! Thanks for the out of hours help :-)

In case it's helpful to others, I've learnt that every level deeper in the tree requires another ../ so:

../../admin/runtime.php

and so on...