|
From: Jon O. <jon...@us...> - 2005-10-15 22:12:25
|
Update of /cvsroot/mxbb/core/modules/mx_mod_rewrite/contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28601/modules/mx_mod_rewrite/contrib Added Files: .htaccess rewrite_custom_defs.php Log Message: Adding support for mod_rewrite --- NEW FILE: rewrite_custom_defs.php --- <?php /** ------------------------------------------------------------------------ * Subject : mxBB - a fully modular portal and CMS (for phpBB) * Author : Jon Ohlsson and the mxBB Team * Credits : The phpBB Group & Marc Morisette * Copyright : (C) 2002-2005 mxBB Portal * Email : jo...@mx... * Project site : www.mxbb-portal.com * ------------------------------------------------------------------------- * * $Id: rewrite_custom_defs.php,v 1.1 2005/10/15 22:12:17 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ // // Module functions class // Do not define module functions outside this class!! // class mx_mod_rewrite_custom { /* Examples given below will define rules for the following site urls: http://domain/home http://domain/forum http://domain/something http://domain/something_more http://domain/info http://domain/info/p1 http://domain/info/p2 http://domain/info/p3 */ function encode($url) { $input = array( // // What to map? // /* // Examples "'(?)index.htm\?page=1($|&|\&)'", // Home "'(?)index.htm\?page=2($|&|\&)'", // Forum "'(?)index.htm\?page=3($|&|\&)'", // Something "'(?)index.htm\?page=4($|&|\&)'", // Something_more "'(?)index.htm\?page=5($|&|\&)'", // info "'(&|\&)dynamic_block=1'", // Sub page 1 "'(&|\&)dynamic_block=2'", // Sub page 2 "'(&|\&)dynamic_block=3'", // Sub page 3 */ ); $output = array( // // Map to... // /* "home\\1", "forum\\1", "something\\1", "something_more\\1", "info\\1", "/p1", "/p2", "/p3", */ ); $url = preg_replace($input, $output, $url); return $url; } } ?> --- NEW FILE: .htaccess --- DirectoryIndex index.php index.cgi index.pl index.shtml index.html # # Limit # <Limit GET HEAD POST> # # Allow access to everyone, but... # order allow,deny allow from all # # Banned: Who, Reason, Reference Link (topic), etc. ???... # # MX # deny from 212.138.47.0/24 # deny from 212.138.64.0/22 </Limit> # deny most common except .php <FilesMatch "\.(inc|tpl|h|ihtml|sql|ini|conf|class|bin|spd|theme|module|exe)$"> deny from all </FilesMatch> #Disable .htaccess viewing from browser <Files ~ "^\.ht"> Order allow,deny Deny from all Satisfy All </Files> <Files ~ "\config.php$"> deny from all </Files> <IfModule mod_rewrite.c> RewriteEngine on # # Custom Defs (examples) # Note: You need the additional catlink version for every rule to support the navigation menu additional vars (main category links only) #RewriteRule ^home/catlink([0-9]*)(.*)$ index.php?page=1&cat_link=$1 [L] #RewriteRule ^home(.*)$ index.php?page=1 [L] #RewriteRule ^forum/catlink([0-9]*)(.*)$ index.php?page=2&cat_link=$1 [L] #RewriteRule ^forum(.*)$ index.php?page=2 [L] #RewriteRule ^something/catlink([0-9]*)(.*)$ index.php?page=3&cat_link=$1 [L] #RewriteRule ^something(.*)$ index.php?page=3 [L] #RewriteRule ^something_more/catlink([0-9]*)(.*)$ index.php?page=4&cat_link=$1 [L] #RewriteRule ^something_more(.*)$ index.php?page=4 [L] # NOTE: The parent rule must be located last in line, since they are executed in order #RewriteRule ^info/p1(.*)$ index.php?page=5&dynamic_block=1 [L] #RewriteRule ^info/p2(.*)$ index.php?page=5&dynamic_block=2 [L] #RewriteRule ^info/p3(.*)$ index.php?page=5&dynamic_block=3 [L] #RewriteRule ^info(.*)$ index.php?page=5 [L] # # General # RewriteCond %{REQUEST_URI} ^(.*)/catlink([0-9]*)(.*)$ RewriteRule ^page([0-9]*)/catlink([0-9]*)(.*)$ index.php?page=$1&cat_link=$2 [L] RewriteCond %{REQUEST_URI} ^(.*)/sub([0-9]*)(.*)$ RewriteRule ^page([0-9]*)/sub([0-9]*)(.*)$ index.php?page=$1&dynamic_block=$2 [L] RewriteCond %{REQUEST_URI} ^/page([0-9]*)(.*)$ RewriteRule ^page([0-9]*)(.*)$ index.php?page=$1$2 [L] RewriteCond %{REQUEST_URI} ^/block([0-9]*)(.*)$ RewriteRule ^block([0-9]*)(.*)$ index.php?block=$1$2 [L] </IfModule> |