Blog URL Rewrite - draft preview not working

  • Hello,


    I'm new to perch and I'm currently working on a new blog site, I've followed the tutorial about using friendly urls to remove the php query string (Friendly URLS). This works fine for published posts but if you are in the perch post editor and click the draft preview up in the top right it takes you to the post.php page but it is blank.


    From the perch post edit page the link is website.com/articles/PostTitle/preview.

    If you type in website.com/articles/post.php?s=PostTitle&preview=all then the post preview appears fine.


    I've added the following to the .htaccess - RewriteRule ^articles/([a-zA-Z0-9-/]+)/preview$ /articles/post.php?s=$1&preview=all [L] as per the help page.


    Any ideas why this might be? I don't really care if the post preview page url appears as website.com/articles/post.php?s=PostTitle&preview=all because only the admin will see it but I'm not sure how to change that link on the post edit page.


    edit: I forgot to say the link in the edit page changes automatically when I change the settings for the blog. So when the "Blog Post Page Path" is set as /articles/post.php?s={postSlug}

    then the edit page preview link is

    website.com/articles/post.php?s=PostTitle&preview=all.

    When you change "Blog Post Page Path" to

    /articles/{postSlug}

    then the preview link changes to

    website.com/articles/PostTitle/preview automatically.




    Colin

  • I found a solution, reordering the rewrites in my .htaccess file solved the problem; I changed the order from:


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

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


    to


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

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


    I'm not really sure why this made a difference, but if somebody can enlighten me that'd be appreciated!


    Colin

  • drewm

    Approved the thread.