404 caused by invisible characters in blog postTitle field
My client had a blog post that was appearing in her site search results and blog listing but following the link for that post 404ed. The original post was included as part of an import from an old WordPress blog. I poked at the slug in phpMyAdmin (making sure the non-alphabetic characters were all hyphens). They certainly looked to be ok. My .htaccess file looked fine. Stumped, I tried deleting the original post and creating a new post within Perch (thinking I’d jiggle the slug handle or something) with the same title and content (copying and pasting from the old post — a clue!) and the new post 404ed, too.
About to make a plea for assistance, I pasted the URL for the confounding blog post into this forum and all was revealed. The link (edited for discretion):
Whatever %E2%80%8B is, it’s invisible and was retained by the blog title field.
I recreated the post by t-y-p-i-n-g the old fashioned way, ensuring no junky invisible special characters, and now it works (of course?).
I was surprised that these type of characters would have been retained in the blog title, a plain text field.
<perch:blog id="postTitle" type="text" label="Title" size="xl autowidth" order="1" required="true" />
The original post was part of a WP import made in mid-late 2015. Possibly any bug/issue that could have allowed such characters to be included in imported content is gone, now. But, I thought to mention it, perhaps as a cautionary tale to others. It’s been a while since the import, and I thought I’d been thorough about scrubbing the site for faulty links, but this still surfaced a year later. Weird.
My short diagnostics, I think everything is up to date (except Twitter, which isn't being used):
Perch: 2.8.31, PHP: 5.6.26, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO Server OS: FreeBSD, cgi-fcgi Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_blog (5.0), perch_forms (1.8.3), perch_podcasts (1.2), perch_twitter (3.5.1) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_podcasts', 'perch_twitter' ); PERCH_LOGINPATH: /perch Image manipulation: GD PHP limits: Max upload 4M, Max POST 8M, Memory: 128M, Total max file upload: 4M F1: 2edba60ed1f613d6dd804feb202456a2 Resource folder writeable: Yes SCRIPT_NAME: /perch/core/settings/diagnostics/index.php REQUEST_URI: /perch/core/settings/diagnostics/