Forum

Thread tagged as: Problem, Error, Blog

Blog preview problem

When I write a blog post and save it as a draft and then try to preview the post, the preview page isn't loading properly. The post is completely missing. I've narrowed it down to something to do with htaccess - i.e. when I remove htaccess it works fine.

I renamed my blog and followed the 'Clean urls' docs. Everything works apart from preview. My htaccess looks like this

<IfModule mod_rewrite.c>  
    RewriteEngine on  
    RewriteRule ^blockchain-bugle/([a-zA-Z0-9-/]+)$ /blockchain-bugle/post.php?s=$1 [L]
</IfModule>

SUMMARY INFORMATION

Perch: 2.8.24, PHP: 5.6.17, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24), perch_blog (5.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/bblf/public_html/perch
PERCH_CORE: /home/bblf/public_html/perch/core
PERCH_RESFILEPATH: /home/bblf/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 256M, Total max file upload: 32M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
DOCUMENT_ROOT: /home/bblf/public_html
HTTP_HOST: bblf.info
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Chris James

Chris James 0 points

  • 5 years ago

It looks like you need to add the preview rewrite as well:

<IfModule mod_rewrite.c>  
    RewriteEngine on  
    RewriteRule ^blockchain-bugle/([a-zA-Z0-9-/]+)/preview$ /blockchain-bugle/post.php?s=$1&preview=all [L]
    RewriteRule ^blockchain-bugle/([a-zA-Z0-9-/]+)$ /blockchain-bugle/post.php?s=$1 [L]
</IfModule>

I think thats done the trick. Thank you Shane :)

  • One slight issue I still have with it though - the post is thee one or two files aren't loading properly on the preview page. The header image for example. The file path its looking for is incorrect. My 'Blockchain-bugle' blog is in a seperate folder. Although my filepath should be '../img/header-img.jpg', in preview its looking for 'blockchain-bugle/img/header-img.jpg'.
Drew McLellan

Drew McLellan 2638 points
Perch Support

Make sure your paths are root-relative:

/path/to/image.jpg

thanks