Testing /modules/ changer

Date 2005-05-16 12:11:34 | Category: Site News

in englishin japanese
Do you know short urls or simplified urls?
Although it works fine with almost case, there are some unavoidable side effets .

This hack is quite simple.
You can change /modules/ as you like.

I think there are much few side effect with this hack.

insert 8 lines into top of mainfile.php

	// modules changer (insert this 8 lines)
	if( ! function_exists( 'modules_changer' ) ) {
		$_SERVER['REQUEST_URI'] = str_replace( '/md/' , '/modules/' , @$_SERVER['REQUEST_URI'] ) ;
		$_SERVER['HTTP_REFERER'] = str_replace( '/md/' , '/modules/' , @$_SERVER['HTTP_REFERER'] ) ;
		function modules_changer( $s ) {
			return str_replace( XOOPS_URL.'/modules/' , XOOPS_URL.'/md/' , $s ) ;
		}
		ob_start( 'modules_changer' ) ;
	}


insert 2 lines into XOOPS_ROOT_PATH/.htaccess

RewriteEngine on
RewriteRule ^md/(.*)$ modules/$1 [L]

27 May 2005 edit:
added replacing $_SERVER['HTTP_REFERER'] for some modules using deep-referer-check. (Protector or WordPressME 0.3x)

18 Feb 2007 edit:
modified the code compatible with some modules reading mainfile.php twice.



You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=54