fix rewriterule
fix #1073 #1074
removed extra parenthesis
added some tests for thesaurus/cterms
Merge pull request #286 from jygaulier/fix_1073_1074

[3.8] Fix 1073 1074