Forums / Cotonti / Extensions / [RELEASE] Cotonti Awesome mod_rewrite URL System

tensh
#14019 2009-07-10 17:48
Hmm, as for me, sometimes the strange error appears from the level of my browser:

"The site cannot be displayed because it uses invalid type of compression."

It happens when I set up advanced url display. I wonder if it can happen due to php accelerators or other types of php cache.

Also, try to login, when using urltrans for username: it also converts user/auth, and so user cannot log in.

See also my comments in your article (and delete them after making use of them)

Edit:

I made a custom function for parsing only users urls:

In fuctions.custom.php:
function users_url_structure(&$args, &$spec)
{
	if ($args['m'] == 'details') 
	{

	$url =  'users/details/'.$args['u'];
	unset($args['u']); 
	unset($args['m']); 
	unset($args['id']); 
	}
	else 
	{ 
	$url = $spec['_area'].'.php'; 
	}

	return $url;
}

In urltrans.dat:

users	*	{users_url_structure()}

In .htaccess:
RewriteRule ^users/([^/&?#]+)/([^/&?#]+)(.*)$ users.php?m=$1&u=$2$3 [QSA,NC,NE,L]

I have no idea if it's coded right (I'm not that experienced in coding), but it works :P

My simple solution for plugins:

In functions.custom.php:

function plug_url_structure(&$args, &$spec)
{
	$url =  'site/'.$args['e'].'.html';
	unset($args['e']);
	
	return $url;
}

In urltrans:
plug	*	{plug_url_structure()}

In htaccess:

RewriteRule ^site/([^/&?#]+)\.html(.*)$ plug.php?e=$1$2 [QSA,NC,NE,L]

I use "site" prefix because all other areas "name.php" are rewritten with "name.html".
This post was edited by tensh (2009-07-10 22:15, 14 years ago)