Topic: XTE shorturls and mos with many args don't work properly
nhorlock
avatar
Freshman
Freshman
Posts: 4

Posted:
14.Mar 2004 - 20:17

Hi guys,
I've got a wee problem with the default .htaccess provided with XTE. The rewrite rules to handle modules have some rules that use Regexp backreferences >9 i.e. $10. This is not supported by mod_rewrite and gets translated as $1 followed by ascii '0' e.g.

Code

module-manyargsmodule-manyargsfunc-arg1-1-arg2-2-arg3-3-arg4-4.html

maps to

Code

index.php?module=manyargsmodule&func=manyargsfunc&arg1=1&arg2=2&arg3=3&arg4=manyargsmdule0

rather than the expected

Code

index.php?module=manyargsmodule&func=manyargsfunc&arg1=1&arg2=2&arg3=3&arg4=4

FYI The rule that matches here is:-

Code

^module-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.html$

This means two things
i) The existing rulebase is wrong and allows corrupt data to be passed to modules.
ii) complex modules with either need special rules or a more complicated set of rules for generic modules needs to be created.

For ii) I imagine that it is possible to write a cascade of rules that progressivle match the args and replace them in batches, having said that I've not yet managed to get such a thing to work yet so any suggestions would be appreciated.

Neil
ColdRolledSteel
avatar
Professional
Professional
Posts: 1310

Posted:
16.Mar 2004 - 00:38

nhorlock

Hi guys,
I've got a wee problem with the default .htaccess provided with XTE. The rewrite rules to handle modules have some rules that use Regexp backreferences >9 i.e. $10. This is not supported by mod_rewrite and gets translated as $1 followed by ascii '0'

Hmm... This bug was in the original rulebase in Simple URLs from www.mtrad.com. Nice to find another derivative work. icon_lol

Quote


This means two things
i) The existing rulebase is wrong and allows corrupt data to be passed to modules.
ii) complex modules with either need special rules or a more complicated set of rules for generic modules needs to be created.

For ii) I imagine that it is possible to write a cascade of rules that progressivle match the args and replace them in batches, having said that I've not yet managed to get such a thing to work yet so any suggestions would be appreciated.

Your conclusions are correct. BTW, I don't think there are too many situations that actually require that many parameters. If you find them, you can usually reduce them down so that they don't need 10.

But, your idea of cascading rules is interesting. I think that I would try having the first rule add some kind of tag so that the second rule could look only for those tags and remove them at the same time that it handles the rest of the parameters...