Mod rewrite

Aus mwcms.net

Wechseln zu: Navigation, Suche

You can use mwCMS without mod_rewrite, but it is not adviced. Please keep in mind, that you will not get any support in our forums on "mod_rewrite" related questions.

If you want to use mwCMS without mod_rewrite, you can change "templates/topnav.htm".

<!-- Find -->
<a href="{tmpl_var name='topnav'}.htm">{tmpl_var name='navigation'}</a>
<!-- and replace with -->
<a href="index.php?topnav={tmpl_var name='topnav'}">{tmpl_var name='navigation'}</a>

You have to change "col1.htm", too:

<!-- Find -->
<a href="{tmpl_var name='topnav'}-{tmpl_var name='leftnav'}.htm"></a>
<!-- and replace with -->
<a href="index.php?topnav={tmpl_var name='topnav'}&amp;leftnav={tmpl_var name='leftnav'}"></a>

If you changed your navigation or do not use YAML, you probably will not find those lines. Please read "Reserved Variables" for more informations on "Superglobals" and "$_GET". You have to secure all "GET parameters" with Regular Expressions! mwCMS is not able to do that for you, because only you know your structure in

  • directy "navigation/"
  • articles in your MediaWiki

so take a look at your "config.php"

/**
 * Security settings
 * It is strongly recommended to activate and use it. E.g. "$_GET['topnav']" could be injected.
 * Usuage in "topnav.php" is "!preg_match(REGEX_TOPNAV, $_GET['topnav']))"
**/
  define('SECURITY', TRUE); // TRUE = on (recommended), FALSE = off
  define('REGEX_TOPNAV', '/[*\\\\\\/|]/'); // regEx for top navigation, please change it to your needs
  define('REGEX_LEFTNAV', '/[*\\\\\\/|]/'); // regEx for left navigation, please change it to your needs

and secure your mwCMS. Be aware that it is not "preg_match(something)" it is "!preg_match(something)". If you want real security, you only use

  • lowercase letter in your directy "navigation/" and all subdirectories
  • change "REGEX_TOPNAV" and "REGEX_LEFTNAV" accordingly and
  • delete the "!" mentioned before,

but you should know what your doing.