Forum

Thread tagged as: Installation, Configuration

Subdomain - Subdirectory

Hey,

This has been asked a few times but i've never really seen a clear answer. I have a website https://www.stefan-wright.com, on that site I have https://www.stefan-wright.com/weddings. This subdirectory can be accessed also from https://weddings.stefan-wright.com (my hosting is with one.com and this is set up automatically).

If I access the page via the /weddings/index.php path it loads all perch content fine, if I try to go to https://weddings.stefan-wright.com/index.php the page fails to load properly with text like <!-- Undefined content: introSection --> in the HTML.

Stefan Wright

Stefan Wright 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That's because Perch sees those two paths (/index.php and /weddings/index.php) as different pages.

Is there a way to get the setup to work then? or am I going to have to setup a redirect all the time from weddings.... to the www..../weddings version?

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Stefan,

Perch has a utility method that "sets the URL Perch should use for the current page", which may be useful in your case.

https://docs.grabaperch.com/functions/utilities/perchsystem/

Place this at the top of the document directly after the runtime include:

PerchSystem::set_page('/weddings/index.php');

Hussein,

You ever get those moments you want to reach through your computer screen and give a massive thanks to someone, right now I wish I could to you! Thank you! that is EXACTLY what I was looking for!