# uname -a

Switch

Mot-clé - GetSimple

Fil des billets - Fil des commentaires

lundi 3 février 2014

GetSimple: URL index/something returns 404

Problem

While using GetSimple with FancyURLs (Apache Rewrite), every menu item nested under the home page returned a 404.

The (rewritted) URL of the home page is /index

The sub-pages URLs are rendered as index/something, and triggered a 404 error.

Solution

Disable MultiViews.

MultiViews is an Apache mechanism for automatically switching wich document is sent to the user, based on the Accept header. Because the front controller is named index.php, MultiViews was trying to reach index.php/something instead of (as specified in RewriteRules) index.php?id=index/something.

How to do it

Open the GetSimple .htaccess file, and locate :

Options -Indexes

Change to :

Options -Indexes -MultiViews

See also

vendredi 15 mars 2013

Getsimple : exotic char causes website crash

Input sanitizing while editing pages is not efficient in GetSimple, incorrect char such as NULL or EOT corrupt XML files and crashes the CMS :

Warning: simplexml_load_string(): Entity: line 106: parser error : CData section not finished 

Here is a patch :

--- admin/inc/basic.php
+++ admin/inc/basic.php
@@ -654,8 +654,15 @@
     } else {
         $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
     }
-    $text = str_replace(chr(12), '', $text);
-    $text = str_replace(chr(3), ' ', $text);
+    $badchars = array();
+    for ($code = 0; $code < 32; $code++) {
+        $badchars[] = chr($code);
+    }
+    unset($badchars[13]);
+    unset($badchars[10]);
+    $text = str_replace($badchars, '', $text);
+    //$text = str_replace(chr(12), '', $text);
+    //$text = str_replace(chr(3), ' ', $text);
     return $text;
 }
Note that it does not fixes the corrupted XML files, it prevents the corrupted files to appear.