Forum

Thread tagged as: Problem

List/Detail Broken After Perch Update

I recently updated to the latest version of Perch and the list/detail solution I'd been using has stopped working.

Before the update, the code on my listing template was…

<a href="projects/<perch:content id="slug" type="slug" />">

This stopped returning anything for me and subsequently redirected to my 404 page.

I'm noticing now that if I switch that code to…

<a href="projects.php?s=<perch:content id="slug" type="slug" />">

It works again but obviously the path is now different. Is there any reason why it would have just stopped working after the update? I'd rather get it back to how it was

For clarity, my .htaccess file has the following line in it…

RewriteRule ^projects/([a-zA-Z0-9-]+)/?$ /projects.php?s=$1 [L]

Thanks

David Ellis

David Ellis 1 points

  • 6 years ago

Clearly this seems to be an issue with the rewrite rule, what I'm not understanding though is why it would just stop working after being fine before

David. Is perch outputting file extensions after update? Your first example has no file extensions which may be causing problems.

Hi Robert,

The rewrite rules are sorting out the removal of file extensions, or should I say, they were.

Everywhere else across the site the rewrite rules are behaving and dropping off the file extensions. They're working fine on the blog, fine on the basic pages. Just this one section has stopped working and I don't see why.

That's why I ask if perch is NOW outputting extensions where it wasn't before. Extensions would bypass the rewrite rule. The rewrite rule is not an issue itself, but if perch is now outputting extension then rewrite will be bypassed.

Hi Robert, how do I find out? (thanks for the help by the way)

Restore the template and see what is output in the html. Comment out the rewrite rule while testing.

The html doesn't pull any of the data through, the page is essentially blank

What is the html of the link? Your building an href with perch:content. With the template restored what is the output LINK

It's as you would expect…

<a href="https://siteurl.com/projects/slug-name">

Based on your current post, the output includes https://siteurl .com but the original was not. So I am guessing this is the problem as your link is not relative it's now absolute.

I don't think that's it. That's probably my fault for pasting the absolute URL. The path is the same, the code hasn't changed. It's just when you visit the link now there's no content.

Testing this locally (backwards I know), it works completely fine. Just on the live site where it doesn't behave.

Ok this one is solved.

Including the following code in my .htaccess file fixed it…

Options -MultiViews
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the generated markup any different, or is it just the rewrite rule?

As far as I'm aware it's the same. Nothing was changed, it was just a Perch update.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Something must have changed somewhere.