Forum
Finding /blog/post.php when all of perch is in a subfolder
I’m using Perch for just one portion of my site that lives in a folder, so things aren't at the root of the site. I'm having a problem because when I add the <perch:blog id="postURL" />
to link to individual posts I'm getting a 404 because it can't find the /blog/post.php
which is because it's actually at /[FOLDER]/blog/post.php
I've done a lot of searching around but can't figure out what I need to change to tell Perch to look in the right place for the post.php file. Anyone know what I should be changing? Or maybe I'm diagnosing this problem incorrectly?
I've not installed Perch in a sub-folder but what do you have for "Blog post page path" in Admin - Settings?
I do have the folder it's in there, so it's
/[FOLDER]/blog/{postSlug}
and in the url for the link to an individual post it's correct when I look at it rendered in the page, which is why I'm stumped on it not finding the/blog/post.php
file.What value is
postURL
outputting?So the url that I'm getting is
/microblog/blog/2018-09-06-post-37
for the latest post when I have<perch:blog id="postURL" />
in thehref
. I'm doing the URL rewriting for a clean url that's talked about here: https://docs.grabaperch.com/addons/blog/examples/clean-urls-perch/. My rewrite is as follows:Perch is sitting in a folder of
microblog
on my site (athttps://susanjeanrobertson.com/microblog/
), I'm using it just for that and then the rest of my site uses Jekyll. I realize this is a bit of odd usage, but I didn't want to change over my whole site when I really only wanted the ability to update my microblog from the web easily.Is that not correct? It looks correct.
It is the correct url, but when I go to the url I get the 404 that it can't find
/blog/post.php
which is why I'm confused.......the file is there at
/microblog/blog/post.php
should I think it should find it, but it's not :(Ok, how can I help?
So I did an experiment to see what happens and if I move the file for the
post.php
to a folderblog
at the root, it works (with errors due to not findingruntime.php
etc because I just wanted to see what happens and wasn't trying to make everything work.Is there a reason that Perch is looking for that file at the root when I have the entirety of Perch in a folder? In my blog admin settings I have my url as being the one with the
/microblog
on the end and I've set everything else up for that, but Perch is looking for that file in a place that I don't think it should be looking. And I'm not sure why.Are you having problems with routing or with outputting links?
Routing I think. For some reason Perch is looking for the post.php file in the wrong place and I have no idea why.
Do you still have this rewrite rule in place?
Yes I do, on my production site I'm not linking to the individual posts yet, so I've left all the other stuff there for when I figure out what the problem is.
Is that rule not matching the pages you're having problems with?
So I changed the rule to this:
and it seems I'm getting closer, I now have my site 404 page instead of the browser just telling me it can't find
/blog/post.php
The url for the posts is correct now and the rewrite (I think) is correct, but it just doesn't want to use the individual post page to do this.
And I'll be honest, maybe it's time to give up here, because I'm clearly now figuring out what the problem is or how to solve it and I don't know if I can.