Forum

Thread tagged as: Problem, Runway, Blog

Runway blog 404 on post pages

Hi,

I've just upgraded a site to Runway and everything is working great except for the Blog post pages which are returning a 404.

I've added a routing token in the runway.php file as follows:

'routing_tokens' => [
    'blogslug' => '[1-2][0-9]{3}\-[0-9]{2}\-[0-3][0-9]-[a-z0-9\-]+',
],

and my Post page has the following routes in place:

blog/[blogslug:s]
blog/[blogslug:s]/[preview:preview]

The Blog post page path is set to: /blog/{postSlug}/ and the Slug format to {postTitle}.

A couple of weeks before moving the site to Runway, I'd changed the Slug format to {postTitle} from %Y-%m-%d-{postTitle}. If I now revert the Slug format to %Y-%m-%d-{postTitle} (and resave the blog posts) then I'm able to view the post correctly. But then changing the Slug format back to {postTitle} brings back the 404 when I try to view any post.

Another thing that I've seen is that some rewrites that I have in place in my .htaccess file are no longer working after moving to Runway. I have the following at the end of my .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/perch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /perch/core/runway/start.php [L]

And before that in the .htaccess file I have some rewrites that work when the above Runway rules are omitted, but don't work when the Runway rules are in place. An example of one of these rewrite rules is:

RewriteRule ^blog/2016-02-29-up-up-and-away[/]*$ /blog/up-up-and-away/ [R=301]

Here's my Diagnostic report:

Perch Runway: 2.8.34, PHP: 5.6.21, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_blog (5.0), perch_forms (1.8.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_blog', );
PERCH_LOGINPATH: /perch
PERCH_PATH: D:\sites\barcelona-inside-and-out\httpdocs\perch
PERCH_CORE: D:\sites\barcelona-inside-and-out\httpdocs\perch\core
PERCH_RESFILEPATH: D:\sites\barcelona-inside-and-out\httpdocs\perch\resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 9d0af5492cb39525ae51870a987a0b88
Resource folder writeable: Yes
HTTP_HOST: dev.bcn-inside-and-out
DOCUMENT_ROOT: D:/sites/barcelona-inside-and-out/httpdocs
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Is there anything here that seems misconfigured? Thanks in advance for your help!

Simon Kelly

Simon Kelly 0 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

You originally had a slug format of %Y-%m-%d-{postTitle}

You've changed the slug format to {postTitle}

But you haven't changed your routes for the post page - they need to be:

blog/[slug:s] 
blog/[slug:s]/[preview:preview]

Hi Duncan,

Ah, you're absolutely right — thanks very much for spotting that!

My rewrite rules (which I have in place to handle the change in blog post url format) are still not working but I guess this is now a purely .htaccess issue. I'll carry on looking at it and maybe create a separate thread if I need to.

Thanks again,

Simon