Forum

Thread tagged as: Problem, Runway

Upgrading Perch to Runway - Clean URL issue?

I'm upgrading a Perch site to Runway. The original site uses clean URLs and contains several list/detail pages. I'm following along with the docs and have moved a couple of pages to Master Pages, set the paths, but am getting a 500 error when I try to browse to them. I suspect my existing .htaccess rules.

Right now the page I am focusing on is /weddings.php which is a list/detail page.

Here is my htaccess:

DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine on

# Eliminate www.*
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# BLOG
  RewriteRule ^post/([a-zA-Z0-9-/]+)/preview$ /post.php?s=$1&preview=all [L]
  RewriteRule ^post/([a-zA-Z0-9-/]+)$ /post.php?s=$1 [L]

  RewriteRule ^blog/page/([0-9]+)/{0,1}$ /blog.php?page=$1 [L]

  RewriteRule ^blog/category/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /blog.php?cat=$1&page=$2 [L]
  RewriteRule ^blog/category/([a-zA-Z0-9-/]+)$ /blog.php?cat=$1 [L]

  RewriteRule ^blog/date/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /blog.php?year=$1&page=$2 [L]
  RewriteRule ^blog/date/([a-zA-Z0-9-/]+)$ /blog.php?year=$1 [L]

  RewriteRule ^blog/tag/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /blog.php?tag=$1&page=$2 [L]
  RewriteRule ^blog/tag/([a-zA-Z0-9-/]+)$ /blog.php?tag=$1 [L]

# OTHER
  RewriteRule ^weddings/([a-zA-Z0-9-/]+)$ /weddings.php?w=$1 [L]
  RewriteRule ^_press-slide/([a-zA-Z0-9-/]+)$ /_press-slide.php?s=$1 [L]
  RewriteRule ^_team-slide/([a-zA-Z0-9-/]+)$ /_team-slide.php?s=$1 [L]
  RewriteRule ^_property-popup/([a-zA-Z0-9-/]+)$ /_property-popup.php?s=$1 [L]

# Enable .php without extension, eliminate trailing slash
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
  RewriteRule (.*)\.php$ /$1 [L,R=301]

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)/$ /$1 [R=permanent,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^(.+)$ $1.php [L,QSA]

# Perch Runway
  RewriteCond %{REQUEST_URI} !^/easton-admin 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule .* /perch/core/runway/start.php [L] 
</IfModule>

# Set UTF-8
AddDefaultCharset utf-8
<IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
</IfModule>

# Eliminate viewable directories
<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# Compression
<IfModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      application/xhtml+xml \
                                      application/xml \
                                      font/opentype \
                                      image/svg+xml \
                                      image/x-icon \
                                      text/css \
                                      text/html \
                                      text/plain \
                                      text/x-component \
                                      text/xml
    </IfModule>
</IfModule>

# 3rd Party Fonts
<IfModule mod_headers.c>
    <FilesMatch "\.(eot|otf|ttc|ttf|woff)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

# File Cache Expirations
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                                      "access plus 1 month"

  # CSS
    ExpiresByType text/css                              "access plus 1 year"

  # Data interchange
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
    ExpiresByType text/x-component                      "access plus 1 month"

  # HTML
    ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
    ExpiresByType application/javascript                "access plus 1 year"

  # Manifest files
    ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
    ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
    ExpiresByType audio/ogg                             "access plus 1 month"
    ExpiresByType image/gif                             "access plus 1 month"
    ExpiresByType image/jpeg                            "access plus 1 month"
    ExpiresByType image/png                             "access plus 1 month"
    ExpiresByType video/mp4                             "access plus 1 month"
    ExpiresByType video/ogg                             "access plus 1 month"
    ExpiresByType video/webm                            "access plus 1 month"

  # Web feeds
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
    ExpiresByType application/font-woff                 "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
    ExpiresByType application/x-font-ttf                "access plus 1 month"
    ExpiresByType font/opentype                         "access plus 1 month"
    ExpiresByType image/svg+xml                         "access plus 1 month"
</IfModule>

# MIME Types
<IfModule mod_mime.c>
  # Audio
    AddType audio/mp4                                   m4a f4a f4b
    AddType audio/ogg                                   oga ogg

  # JavaScript
    # Normalize to standard type (it's sniffed in IE anyways):
    # https://tools.ietf.org/html/rfc4329#section-7.2
    AddType application/javascript                      js jsonp
    AddType application/json                            json

  # Video
    AddType video/mp4                                   mp4 m4v f4v f4p
    AddType video/ogg                                   ogv
    AddType video/webm                                  webm
    AddType video/x-flv                                 flv

  # Web fonts
    AddType application/font-woff                       woff
    AddType application/vnd.ms-fontobject               eot

    # Browsers usually ignore the font MIME types and sniff the content,
    # however, Chrome shows a warning if other MIME types are used for the
    # following fonts.
    AddType application/x-font-ttf                      ttc ttf
    AddType font/opentype                               otf

    # Make SVGZ fonts work on iPad:
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType     image/svg+xml                           svg svgz
    AddEncoding gzip                                    svgz

  # Other
    AddType application/octet-stream                    safariextz
    AddType application/x-chrome-extension              crx
    AddType application/x-opera-extension               oex
    AddType application/x-shockwave-flash               swf
    AddType application/x-web-app-manifest+json         webapp
    AddType application/x-xpinstall                     xpi
    AddType application/xml                             atom rdf rss
    AddType image/webp                                  webp
    AddType image/x-icon                                ico
    AddType text/cache-manifest                         appcache manifest
    AddType text/vtt                                    vtt
    AddType text/x-component                            htc
    AddType text/x-vcard                                vcf
    AddType application/x-httpd-php5 .php5 .php .php3 .php2 .xml
</IfModule>

Here is the master page at /templates/pages/weddings.php (I know those PHP includes are probably not going to work, but I need to get the 500 fixed first). In Perch, the path for this page is '/weddings'.

<?php

if (perch_get('w')) {

// ITEM MODE
$page_footer_scripts = <<<PFS
<script type="text/javascript" src="/js/jquery.lazyload.min.js?v=2015111301"></script>
<script type="text/javascript" src="/js/incl-wedding-item.js?v=2015111301"></script>
PFS;
$result = perch_collection("Weddings", array(
 "template"=>"wedding_item.html",
 "filter"=>"slug",
 "match"=>"eq",
 "value"=>perch_get('w'),
 'skip-template' => true,
 'return-html' => true,
));
define('PAGE_TITLE',$result[0]['title']);
include('_header.php');
include('_navigation.php');
echo $result['html'];
perch_collection('Weddings', array(
    'template'   => 'wed_prev.html',
    'filter'     => '_order',
    'match'      => 'lt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'DESC',
    'count'      => 1
));
perch_collection('Weddings', array(
    'template'   => 'wed_next.html',
    'filter'     => '_order',
    'match'      => 'gt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'ASC',
    'count'      => 1
));
echo '</div></div></div><a href="javascript:void(0);" id="bttBtn"></a>';

} else {

// LIST MODE
$page_footer_scripts = <<<PFS
<script type="text/javascript" src="/js/jquery.lazyload.min.js?v=2015111301"></script>
<script type="text/javascript">
$("#wedListContainer .imgLink img").lazyload({
    threshold : 400,
    effect : "fadeIn"
});
</script>
PFS;
define('PAGE_TITLE',perch_pages_title(true));
include('_header.php');
include('_navigation.php');
perch_collection('Weddings', array(
    'template'=>'wedding_list.html'
)); 

}

include('_footer.php');
?>

And here is diagnostics. Just noticed the temp folder issue...though I'm not sure how I'm going to handle that in XAMPP just yet. Planning to move to Vagrant very soon but I need to get this done first!

Perch Runway is up to date
PHP 5.5.11 is up to date
MySQL 5.6.16 is up to date
Image processing available
Temp folder is not writable. Check the path to your temp folder in your runway.php file and check permissions are set for PHP to write to it.
SUMMARY INFORMATION

Perch Runway: 2.8.19, PHP: 5.5.11, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.19), assets (2.8.19), categories (2.8.19), perch_blog (5.0), perch_forms (1.8.3), collection_1 (2.8.19), perch_members (1.4)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_blog', 'perch_forms' );
PERCH_LOGINPATH: /easton-admin
PERCH_PATH: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin
PERCH_CORE: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin\core
PERCH_RESFILEPATH: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin\resources
Image manipulation: GD
PHP limits: Max upload 1000M, Max POST 1000M, Memory: 500M, Total max file upload: 500M
Resource folder writeable: Yes
HTTP_HOST: easton.dev
DOCUMENT_ROOT: D:/Shane/The Vault/Work/Tech/Easton/_easton.dev
REQUEST_URI: /easton-admin/core/settings/diagnostics/
SCRIPT_NAME: /easton-admin/core/settings/diagnostics/index.php
Shane Lenzen

Shane Lenzen 18 points

  • 5 years ago

Fixed the temp folder issue, FYI.

HEALTH CHECK

Perch Runway is up to date
PHP 5.5.11 is up to date
MySQL 5.6.16 is up to date
Image processing available
SUMMARY INFORMATION

Perch Runway: 2.8.19, PHP: 5.5.11, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.19), assets (2.8.19), categories (2.8.19), perch_blog (5.0), perch_forms (1.8.3), collection_1 (2.8.19), perch_members (1.4)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_blog', 'perch_forms' );
PERCH_LOGINPATH: /easton-admin
PERCH_PATH: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin
PERCH_CORE: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin\core
PERCH_RESFILEPATH: D:\Shane\The Vault\Work\Tech\Easton\_easton.dev\easton-admin\resources
Image manipulation: GD
PHP limits: Max upload 1000M, Max POST 1000M, Memory: 500M, Total max file upload: 500M
Resource folder writeable: Yes
HTTP_HOST: easton.dev
DOCUMENT_ROOT: D:/Shane/The Vault/Work/Tech/Easton/_easton.dev
REQUEST_URI: /easton-admin/core/settings/diagnostics/
SCRIPT_NAME: /easton-admin/core/settings/diagnostics/index.php
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Looking in your PHP error log is the place to start. A 500 error is like a "blank screen" it indicates there is a PHP error but not what it is.

Your error log should tell you the actual error.