Displaying items by tag: examples

Wednesday, 15 January 2014 00:00

Examples and solutions to common problems

These are some of the common questions posted on support forum.

How toSolution
Match only site’s homepage:
http://www.mysite.com/

Create an item as follow:

From URL: ^/$
Request only: true (checked)

The expression means “start with (^) and end with ($) slash (/)” (i.e. there’s ONLY the slash).

Match an URL with one or more parameters:
http://www.mysite.com/catalog.php?page=1&order=asc

Create an item as follow:

From URL: /catalog\.php\?page=1&order=asc

Or:

/catalog\.php[[.question-mark.]]page=1&order=asc

In both cases you need to "escape" special chars like the question mark (?) or the dot (.) as you need them "literal". You can do it with a backslash (\) behind, (or using special strings like "[[.question-mark.]]").

Match with a single rule all the URLs like the following:

/index2.php?option=com_content&task=view&id=159&pop=1&page=52&Itemid=10218
/index2.php?option=com_content&task=view&id=17&pop=1&page=0&Itemid=72
/index2.php?option=com_content&task=view&id=301&pop=1&page=0&Itemid=10440
/index2.php?option=com_content&task=view&id=77&pop=1&page=0&Itemid=113
...

Create an item as follow:

From URL: /index2\.php\?option=com_content&task=view&id=[0-9]{1,3}&pop=1&page=[0-9]{1,2}&Itemid=[0-9]{1,5}

The expression [0-9]{1,5} means "a sequence from 1 to 5 digits".

Redirect from an old folder to a new one:

Old structure: http://www.mysite.com/category/oldfolder/anything

New structure: http://www.mysite.com/category/newfolder/anything

Create an item as follow:

From URL: ^/category/oldfolder/
To URL: {scheme}://{siteurl}/category/newfolder/{pathltrim /category/oldfolder/}{queryfull}
Request only: true (checked)
Published in ReDJ for Joomla 2.5