ReDJ for Joomla 2.5
This feature allows to record all the referers for site visitors. A trace log with all referers is available, and this can be useful to identify traffic sources for the web site.
For any referer item in the list the following fields are available:
Name | Value | Description |
---|---|---|
Visited URL | Text | Absolute URL visited by users (e.g. http://www.yoursite.com/trackme.html). |
Referer URL | Text | Absolute URL of the referer site where the user comes from (e.g. http://www.myfriend.com/linktome.html). |
Domain | Text | This field reports just the domain part for the referer site URL (e.g. www.myfriend.com). |
Hits | Integer | Number of times the referer URL was detected for the visited URL in site’s visits. |
Last Visit | Datetime | This field reports the timestamp for the last time which referer URL was detected for the visited URL in site’s visits. This is useful to check active referer URLs. |
About the available buttons:
Purge button will delete all entries.
Delete button will delete only selected entries.
Reset stats will just reset all statistics (hits and last visit).
Beware that this feature must be activated with a corresponding option in the plugin settings. See paragraph “ Plugin settings” for more details.
In this paragraph we will explain the meaning of each plugin parameter. To edit plugin settings go to menu "Extensions" -> "Plug-in Manager", find "System - ReDJ Community" or "System - ReDJ Enterprise" in the list and click on it to access to configuration page.
In the following table there’s a list of all basic plugin parameters.
Name | Value | Description |
---|---|---|
Custom page 404 | No/Yes | No, disables. Yes, replace Joomla standard error page with a custom one. |
Page 404 | Drop-down list | Allows to select the custom error page to use. Pages can be created under the ReDJ component, section "Pages 404". The page is used only when "Custom page 404" option is set to Yes. |
Track errors | No/Yes | No, disabled. Yes, enable errors trace for site URL calls (trace data are visible under ReDJ component). |
Track referrers | No/Yes | No, disabled. Yes, enable referers trace from site visitors (trace data are visible under ReDJ component). |
Referers to exclude | Text | List of domains to ignore when tracing referers from site visitors, one per row (e.g. www.google.com). The following macros are also available and can be indicated each one on a single row: {self} to exclude the own domain (i.e. internal referer), {none} to exclude visits without referer. |
Redirect any error | No/Yes | No, disabled. Yes, redirect any error call, that don’t match with any (active) redirect item, to a common destination page. Beware that this also replace the custom error 404 page, just because no more error 404 can be obtained from site calls. |
Redirect URL | Text | Absolute URL where to redirect all the errors with a 301 return code (e.g. http://www.google.it). The URL is used only when "Redirect any error" option is set to Yes, and only if none of the enabled items match with the error URL (i.e. after redirect phase). A {siteurl} macro is also supported here. |
In the following table there’s a list of all advanced plugin parameters.
Name | Value | Description |
---|---|---|
Shortcut extensions | Text | List of comma separated file extensions to drop on error page for 404 error (e.g. gif,jpg,jpeg,png). This can be useful, as example, to avoid the full redirect process for each call to a non-existing image. |
Base path | Text | The web site base installation path (e.g. /myportal if the site's homepage is http://www.mysite.com/myportal). This string will be dropped from any request before to check redirection rules. This increase portability for configured items. Leave blank if the site is installed on the root. |
These are some of the common questions posted on support forum.
How to | Solution |
---|---|
Match only site’s homepage: http://www.mysite.com/ |
Create an item as follow: From URL: ^/$ 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 |
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/ |
Referring to an URL like the following:
Here is a list of supported macros for destination "To URL" field:
Macro | Description |
---|---|
URL macros | |
{siteurl} | Web site address
Example
www.example.com/path/to/Joomla |
{scheme} | URL scheme
Example
http |
{host} | URL host
Example
www.example.com |
{port} | URL port number
Example
8080 |
{user} | User name
Example
fredbloggs |
{pass} | User password
Example
itsasecret |
{path} | URL path
Example
/path/to/Joomla/section/cat/index.php |
{query} | URL query string
Example
task=view&id=32 |
{queryfull} | URL query string full (with question mark)
Example
?task=view&id=32 |
{querybuild var1=value1,...,varN=valueN} | Builds URL query containing only specified variables. If a value is specified for a variable, this is assigned to the variable
Example
{querybuild id,task} => id=32&task=view |
{querybuildfull var1=value1,...,varN=valueN} | Same as 'querybuild' but with question mark
Example
{querybuildfull id,task} => ?id=32&task=view |
{querybuildappend var1=value1,...,varN=valueN} | Same as 'querybuild' but with ampersand
Example
{querybuildappend id,task} => &id=32&task=view |
{querydrop var1=value1,...,varN=valueN} | Builds URL query removing specified variables from the original query. If a value is specified for a variable, this is assigned to the variable (that is not dropped) - ENTERPRISE VERSION ONLY
Example
{querydrop task} => id=32 |
{querydropfull var1=value1,...,varN=valueN} | Same as 'querydrop' but with question mark - ENTERPRISE VERSION ONLY
Example
{querydropfull task} => ?id=32 |
{querydropappend var1=value1,...,varN=valueN} | Same as 'querydrop' but with ampersand - ENTERPRISE VERSION ONLY
Example
{querydropappend task} => &id=32 |
{queryvar varname,default} | Returns the current value for the variable 'varname' of the URL, or the value 'default' if 'varname' is not defined (where default = '' when not specified)
Example
{queryvar task} => view |
{requestvar varname,default} | Returns the current value for the variable 'varname' of the request, no matter about method (GET, POST, ...), or the value 'default' if 'varname' is not defined (where default = '' when not specified)
Example
{requestvar id} => 32 |
{authority} | URL authority string
Example
fredbloggs:itsasecret@www.example.com:8080 |
{baseonly} | Returns the base path only (empty when installed on root, i.e. it will never contains a trailing slash)
Example
/path/to/Joomla |
{pathfrombase} | Returns the path without the base part
Example
/section/cat/index.php |
{pathltrim pathtotrim} | Strip the string specified (pathtotrim) from the beginning of the path and returns the result
Example
{pathltrim /path/to} => /Joomla/section/cat/index.php |
{pathrtrim pathtotrim} | Strip the string specified (pathtotrim) from the end of the path and returns the result
Example
{pathrtrim /index.php} => /path/to/Joomla/section/cat |
{pathfrombaseltrim pathtotrim} | Same as 'pathltrim' but works on path without the base part - ENTERPRISE VERSION ONLY
Example
{pathfrombaseltrim /section} => /cat/index.php |
{pathfrombasertrim pathtotrim} | Same as 'pathrtrim' but works on path without the base part - ENTERPRISE VERSION ONLY
Example
{pathfrombasertrim index.php} => /section/cat/ |
{preg_match N}pattern{/preg_match} | Returns the N-th matched pattern on the 'full source URL', where N = 0 when not specified - ENTERPRISE VERSION ONLY
Example
{preg_match}/([^\/]+)(\.php|\.html|\.htm)/i{/preg_match} => index.php |
{routeurl} | Returns the routed (relative) URL using all current variables
Example
/using-joomla.html |
{routeurl var1,var2,var3=myvalue,..,varN} | Returns the routed (relative) URL for specified variables
Example
index.php?var1=value1&var2=value2&var3=myvalue&..&varN=valueN |
{pathfolder N} | Returns the N-th folder of the URL path - ENTERPRISE VERSION ONLY
Example
{pathfolder 4} of /path/to/Joomla/section/cat/index.php => section |
{pathfolder last-N} | Returns the (last-N)-th folder of the URL path, where N = 0 when not specified - ENTERPRISE VERSION ONLY
Example
{pathfolder last-1} of /path/to/Joomla/section/cat/index.php => cat |
Site macros | |
{sitename} | Global site name
Example
Global $sitename configuration value |
{globaldescription} | Global site meta description
Example
Global $MetaDesc configuration value |
{globalkeywords} | Global site meta keywords
Example
Global $MetaKeys configuration value |
{username} | Returns the current username
Example
{username} => admin |
{username default} | Returns the current username or the value 'default' for guest users
Example
{username nobody} => nobody |
{userid} | Returns the current user ID
Example
{userid} => 62 |
{userid default} | Returns the current user ID or the value 'default' for guest users
Example
{username 1001} => 1001 |
Database macros | |
{tableselect table,column,key}value{/tableselect} | Returns result of a SQL query (SELECT column FROM table WHERE key = value). Support #__ notation for table name
Example
{tableselect #__users,username,id}135{/tableselect} => SELECT username FROM #__users WHERE id = 135 |
{preg_select table,column,key,N}pattern{/preg_select} | Same as 'preg_match' but uses the matched result to execute a SQL query (SELECT column FROM table WHERE key = matchN). Support #__ notation for table name - ENTERPRISE VERSION ONLY
Example
{preg_select #__content,title,id,1}/id=([0-9]+)/i{/preg_match} => SELECT title FROM #__content WHERE id = 32 |
{placeholder_select table,column,key1=placeholder1,..,keyN=placeholderN} | Returns result of a SQL query (SELECT column FROM table WHERE key1 = ${placeholder1} AND ... AND keyN = ${placeholderN}) where ${placeholderN} is the value of the placeholder with name placeholderN. Support #__ notation for table name. The 'placeholder' must be previously defined (just placeholder name needed, not ${} format) - ENTERPRISE VERSION ONLY
Example
userId=62 |
String macros | |
{substr start,length}text{/substr} | Returns the portion of string specified by the start and length parameters. String are zero-based (i.e. first char has index 0)
Example
{substr 1,3}Joomla{/substr} => oom |
{strip_tags}text{/strip_tags} | Strip HTML and PHP tags from the given string
Example
{strip_tags}<p>hello<br/>Joomla</p>{/strip_tags} => helloJoomla |
{extract N}text{/extract} | Returns the Nth sentence delimited with carriage return (DOS, UNIX or MAC format). All HTML tags stripped
Example
{extract 1}<p>This is a sentence.\nAnd this is another one.</p>{/extract} => This is a sentence. |
{extractp N}text{/extractp} | Returns the Nth HTML paragraph <p></p>. All HTML tags stripped
Example
{extractp 2}<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p>{/extractp} => Second paragraph |
{extractdiv N}text{/extractdiv} | Returns the Nth HTML paragraph <div></div>. All HTML tags stripped
Example
{extractp 3}<div>First paragraph</div><div>Second paragraph</div><div>Third paragraph</div>{/extractp} => Third paragraph |
{preg_subject N,subject}pattern{/preg_subject} | Returns the N-th matched pattern on the 'subject', where N = 0 when not specified. The 'subject' can contain placeholders, but cannot contain standalone '}' chars - ENTERPRISE VERSION ONLY
Example
{preg_subject 2,First/Second/Third}/([^\/]+)\/([^\/]+)\/([^\/]+)/i{/preg_subject} => Second |
{preg_placeholder N,placeholder}pattern{/preg_placeholder} | Returns the N-th matched pattern on the 'placeholder' evaluated string, where N = 0 when not specified. The 'placeholder' must be previously defined (just placeholder name needed, not ${} format)
Example
a=First/Second/Third |
{lowercase}pattern{/lowercase} | Returns the pattern in lower case
Example
{lowercase}ALL to Lower{/lowercase} => all to lower |
{uppercase}pattern{/uppercase} | Returns the pattern in upper case
Example
{uppercase}ALL to UppeR{/uppercase} => ALL TO UPPER |
{urldecode}pattern{/urldecode} | Returns the decode pattern using urldecode() function
Example
{urldecode}%2Fgoto%20home%2F{/urldecode} => /goto home/ |
{urlencode}pattern{/urlencode} | Returns the encoded pattern using urlencode() function
Example
{urlencode}/encode me/{/urlencode} => %2Fencode%20me%2F |
{rawurldecode}pattern{/rawurldecode} | Returns the decode pattern using rawurldecode() function
Example
{rawurldecode}foo%20bar%40baz{/rawurldecode} => foo bar@baz |
{rawurlencode}pattern{/rawurlencode} | Returns the encoded pattern using rawurlencode() function
Example
{rawurlencode}foo @+%/{/rawurlencode} => foo%20%40%2B%25%2F |
{str_replace search,replace}pattern{/str_replace} | Returns the pattern after replacing 'search' with 'replace'
Example
{str_replace john,scott}my name is john{/str_replace} => my name is scott |
ReDJ allows to create a custom error page that can replace the Joomla standard one. To manage error pages go to menu "Components" -> "ReDJ" -> "Pages 404".
There are always two predefined pages as default, with titles "Italiano" (ID = 1) and "English" (ID = 2). These are example pages, added just to show how to create HTML for a custom error page. Specifically, these pages are identical to Joomla standard error page, except they add the email address of site Administrator, showing how to use supported macros.
BEWARE: do NOT customize these pages, because these are deleted and recreated on each ReDJ upgrade, so any changes will be lost. It’s better to add a new page (ID > 2) and use this.
For any custom error page the following fields are available:
Name | Value | Description |
---|---|---|
Title | Text | The title to identify the custom error page. |
Language Name | Text | The language identifier for the custom error page. |
Page | Text | Insert HTML code of the custom error page. The following macros can be used:
|
Hits | Integer | Number of times the custom error page were used (i.e. returned to site visitors). |
Last visit | Date | Last time the custom error page were used. |
Once a custom error page was created, it can be enabled in ReDJ system plugin. Select menu "Extensions" -> "Plug-in Manager" and open plugin "System - ReDJ Community" or "System - ReDJ Enterprise". Under "Basic Options" set "Custom page 404" to yes and select the page to use from the drop-down list. See paragraph "Plugin settings" for more details.
With this function it is possible to record all errors that the site receives. This provide a kind of trace log for error requests, and can be useful to identify dead backlinks that need to be redirected elsewhere. Analyzing requests it is also possible to extract other useful information (e.g. to detect if the site is subject to hacker attacks like remote file inclusion or sql injection).
For any error item recorded the following fields are available:
Name | Value | Description |
---|---|---|
Visited URL | Text | Absolute wrong URL called by users (e.g. http://www.yoursite.com/an-old-page.html). |
Error Code | Integer | The error code generated by Joomla for the page (usually 404 – Not Found). |
Hits | Integer | Number of times the wrong URL was called by users. |
Last Visit | Datetime | This field reports the timestamp for the last time which wrong url was called by an user. This is useful to check if the problem is solved by a redirection (in this case, the timestamp doesn't change anymore). |
Last Referer | Text | This field reports the site referer for the last request of the wrong url. This is useful to identify which sites has dead backlinks to your pages. |
About the available buttons:
Purge button will delete all entries.
Delete button will delete only selected entries.
Reset stats will just reset all statistics (hits and last visit).
Beware that this feature must be activated with a corresponding option in the plugin settings. See paragraph “ Plugin settings” for more details.
To create a redirection rule go to menu "Components" -> "ReDJ" –> "Redirects", and click on “New” button. A form will be shown to entering redirection information related to the rule.
The "From URL" field must contains an "URL part" to match with any requested URL. If "Request only" is checked, then URL parts "scheme", "user", "pass", "host" and "port" will be ignored, otherwise the full requested URL will be checked. It is also possible to use Regular Expressions in "From URL" field. ReDJ supports regular expressions according to Henry Spencer's implementation:
http://dev.mysql.com/doc/refman/5.0/en/regexp.html
This option makes it possible to create complex patterns to match a bunch of URLs to redirect with just a single redirection rule.
The field "To URL" must contains the destination URL where to redirect the web browser for any requested URL that matches with the current rule. It must specify an absolute URL, starting with the "scheme" part. The "To URL" field can contains macros and placeholders to build the destination dynamically. Each macro or placeholder is evaluated after an URL matches, and its value is replaced to the macro or placeholder itself. Support of regular expressions, macros and placeholders allow to build complex URL trasformations.
The field "Skip" is optional. Like "From URL" it can contains an "URL part" and supports regular expressions, but its purpose is just the opposite. It allows to specify a condition to skip the rule and its redirect when the condition is satisfied.
The field "Skip user groups" works only for ReDJ Enterprise, and allows to select one or more user groups which skip the rule (i.e. the redirection will not be applied).
The "Redirect" field indicates the redirection type to use. There are three options available:
The Internal Redirect option is available only for ReDJ Enterprise, and allows to change the destination page returned to web browser "internally" to Joomla, on the server side. This means that the user stays on the same URL and cannot notice any changes in the address bar. The Internal Redirect option can be selected also in ReDJ Community, but in this case a standard 301 redirect will be used instead.
About the meanings of other fields:
The statistics fields provide useful information about rule usage. The "Hits" counts the number of times the rule were used, and the "Last visit" indicates the last time the rule were applied.
In the example showed in the image above, the source and the destination are:
From URL: ^/test.html
To URL: http://{siteurl}/
With this settings all the following URLs will be redirected:
http://www.mysite.com/test.html
http://www.mysite.com/test.html?param=xxx
http://www.mysite.com/test_html
While this will not be:
http://www.mysite.com/directory/test.html
This is because in the regular expression ^/test.html the initial caret ^ means "start with", and "request only" is checked, so /directory/test.html will not match. Notice that the URL with /test_html also matches, because the dot means "any char" in the regexp syntax. To specify a literal dot, this should be escaped with \, so the rule should be:
From URL: ^/test\.html
This will match only the first and the second URL of our previous example, but not the third (http://www.mysite.com/test_html).
The destination contains an example of macro, {siteurl}, which will be replaced with www.mysite.com.
As mentioned earlier the "From URL" field can contain a regular expression and can match the whole URL or just a part of it. The following table shows some regexp examples.
"From URL" field | What does it mean |
---|---|
/section/*$ | The dollar ($) means "end with". The star (*) means "match zero or more occurrences of previous character", that is the slash (/). So this rule means "address ends with /section or /section/". |
^/section/9-article\.html$ | The caret (^) means "start with". The dollar ($) means "end with". So the rule means "address starts and ends exactly with /section/9-article.html". |
^/section/11-articles\.php\?id=12$ | The caret (^) means "start with". The dollar ($) means "end with". Also, we need a "literal" question-mark (?) for inline arguments, so it must be escaped with a backslash (\?). So the rule means "address starts and ends exactly with /section/11-articles.php?id=12". Note that any special char needs to be escaped with a backslash to be literal, so we should escape also the dot (.) char. If not escaped, the dot will match with "any char". |
The rules ordering is important for matching the source URL. For each URL request, all published rules are compared according to their ordering. Even if two or more rules match, ONLY THE FIRST ONE in the rule ordering will be used. This can be useful, as example, to distinguish a category from its articles. If we have two URLs as follow:
http://www.mysite.com/category/
http://www.mysite.com/category/article-1.html
Rules could be configured with the following "From URL" field:
Item Order | Wrong Order | Correct Order |
---|---|---|
5 | /category/ | /category/article-1.html |
6 | /category/article-1.html | /category/ |
For http://www.mysite.com/category/article-1.html both rules match this URL, but only the first matching rule is applied so, if rules are configured in the wrong order, the redirect for page article-1.html will never be used.
This feature is available only in the Enterprise version of ReDJ. The 301 (Moved Permanently) or 307 (Temporary Redirect) redirects are client-side redirects. The user from his web browser requests a page (the source URL), and the web server responds with the address to which the page was moved (the destination URL). At this point, it is the client browser that makes a new request for the new address (i.e. is the client that performs the redirect).
With the "Internal Redirect" instead, is the web server that changes the page returned to web browser with the new destination. The result is a server-side redirect (i.e. the redirect happens "internally" to Joomla), and the user does not notice any URL change in the address bar. This is a great solution to create URL aliases and short URLs. Just as example, let's consider an existing URL like the following:
http://www.yoursite.com/index.php/component/reservation/event/4/forum
It is possible to create a rule with a redirection type 200 (Internal) that match to the following URL:
http://www.yoursite.com/training
The page content sent to client is exactly the same for both URLs, but the shortest URL is much friendly and better for SEF and SEO.
Let's take a deeper look at "To URL" destination field. Since version 1.5 of ReDJ, a support for complex "macros" has been added, and this allows to create dynamic destinations. The version 1.7.1 introduces support for "placeholders", that adds a new dimension to build complex URL transformations.
When the URL request matches the "From URL" source field of a rule, if the destination field "To URL" contains one or more macros or placeholders, then ReDJ first calculates and replaces any placeholder and macro with its current value, builds the final "real destination" URL, and finally performs the redirect.
Macros allow, as example, to manipulate pieces of the current matching URL (e.g. a query variable), placeholders can define new variables using constant strings, macros and other (previous) placeholders, so both let you to create dynamic destinations as complex transformations of the current source URL.
Here a practical example of dynamic destinations and macro substitution:
Source URL | http://www.yoursite.com/old/index.php?task=view&id=123&ItemId=3 |
ReDJ "To URL" | http://{siteurl}/new.html{querybuild ItemId=12} |
Destination URL | http://www.yoursite.com/new.html?task=view&id=123&ItemId=12 |
Placeholders allow you to define a set of values where each value is associated and identified by a name. A placeholder can be used in the definition of other placeholders or in the definition of meta info (practically they are based on the same principle of the variables in programming languages). Syntax for defining a placeholder is name=value where 'name' is the placeholder identifier (placeholder valid name, like variables in PHP convention, starts with a letter or underscore, followed by any number of letters, numbers, or underscores), while 'value' can be any string, and can also contains macros or placeholders defined before, and both will be replaced with their current value. The syntax to use a placeholder is ${name}, where 'name' is the name of the placeholder. Each rule has a text area field to define any number of placeholders, one for each row. For example, if you enter:
a=this
b=${a} is
c=${b} an
d=${c} example
Putting the placeholder ${d} in a meta field (e.g. title or description), this field will assume the value 'this is an example'. Here is a practical example of how to use the placeholders to get a complex result through the use of available macros in a sequence of definitions. Let's assume we need to create a rule for URL:
http://www.mysite.com/index.php?option=com_content&view=article&id=53&Itemid=280
We want to withdraw the article id (53), and perform a look-up on the database for getting the article alias (using-joomla), to be used for example in the page title. We can define the following placeholders:
id={preg_match 1}/option=com_content&view=article&id=([0-9]+)/i{/preg_match}
alias={tableselect #__content,alias,id}${id}{/tableselect}
After this, putting ${alias} in the title field, this will be replaced by 'using-joomla' in the page.
The first thing to do is to enable ReDJ plugin. To enable the plugin go to menu "Extensions" -> "Plug-in Manager", find a system type plugin named "System - ReDJ Community" or "System - ReDJ Enterprise" in the plugin list, and click on it to access to plugin settings. Set "Status" to “Enabled”, and set other parameters on the right side according to your needs. Look at "Plugin settings" paragraph for detailed information about each parameter. Click on "Save & Close" button and check that the plugin is now enabled.
Remember that is the plugin that "does the work". The ReDJ component is just the administrative interface for managing redirection rules an other features, but is the plugin that checks site requests and performs redirection and other actions when needed. So, the very first thing to do is to enable the plugin. Note that if you need to disable ReDJ, just disable the plugin.
Another thing to check is the plugins order that can be very important, especially if there are some other plugins that mess with the source URL, redirection and aliases. In most cases it is better to set ReDJ as the first system plugin, so it will be the first to be executed and to check any page call. Now ReDJ is ready to work! You can now create your first redirection rule, and test the redirection through the web browser. Be careful that you could get a cached page. To avoid this just clear server-side cache from backend (menu "Maintenance" -> "Clean Cache"), and client-side cache from your web browser.
Some non-existing URLs are managed directly by Apache that returns the 404 error page.
To manage these URLs with ReDJ and make redirection it is necessary to tell to Apache to pass 404 errors to Joomla (and ReDJ). To do this, it is enough to append this directive at the end of Joomla standard .htaccess file:
ErrorDocument 404 /
ReDJ extension has just one package to download and install. The package includes a component and a plugin, and supports the installation with "upgrade" mode, so there’s no need any more to uninstall any previous version of ReDJ.
To install ReDJ, login to Joomla backend as administrator, and go to menu "Extensions manager". Click the browse button, select the package file (ReDJX.XCommunity.zip or ReDJX.XEnterprise.zip) and click the installation button.
That’s all. Now we are ready to start using ReDJ.
When upgrading from a previous version of ReDJ, there is no need to first uninstall the old package. As mentioned earlier, ReDJ supports the "upgrade" mode for the installation, so it is enough to just install the new package over the old one, both component and plugin will be upgraded.
Note that during the upgrade also the database tables are upgraded when needed, but without to delete or loose any table data. It is in charge of the installation process to upgrade tables structure as needed. All the rules will be preserved.
ReDJ is a Joomla native extension that allows to efficiently manage URL redirection. This is very useful for creating URL aliases, and managing redirects from an old URL to a new one. A very similar extension has been added into Joomla since version 1.6, but ReDJ supports powerful regular expressions that allow to match more than one source URL. In this way it is possible to create a group of redirects with just one ReDJ rule.
ReDJ also supports usage of "macros" in the destination URL. A macro is like a function whose value is calculated at runtime (when the rule matches an URL). There are a loto of macros available and this allows to create dynamic destinations, with a different redirection for each source URL. To increase flexibilty in the building of dynamic destinations, also "placeholders" are supported. A placeholder is like a variable whose value can be assigned using text, macros or other placeholders, and can be used to build the destination.
Another great ReDJ feature is the configurable redirection type for each item, with support for 301 (Moved Permanently), 307 (Temporary Redirect) and also 200 (Internal Redirect) (available for Enterprise version only). With the Internal Redirect is now possible to create a "real" URL alias with Joomla.
Last but not least, there are many other features available, such custom error pages, error tracing, referer tracing and so on, that can dramatically improve your SEO ranking. We will describe each one in detail in the next part of this guide. In the following paragraphs we will also learn how to make better use of regular expressions, macros and placeholders to take full advantage from ReDJ.
ReDJ package includes a component for managing list of redirection rules, and a plugin that examines all the requests and redirect them to a different page when needed by an active rule. These are the main steps to start using ReDJ (for the impatient):
Detailed instructions on each step are described in the following paragraphs. In this section we just want to focus on some basic concepts related to ReDJ and how it works.
The first important thing to understand is the "rule" concept. With ReDJ Manager (the component interface) you can create as many items as you want, and each item is a redirection rule. But not necessarily an item corresponds to a single page (i.e. matches just a single URL).
A rule has a "From URL" field that can be full URI or just a part of it. For example, it can be "/home.html", then this rule matches both the URL http://www.mysite.com/home.html and http://www.mysite.com/orders/home.html?view=status. So, it means that with a single rule is possible to match multiple source URLs. But the content of the "From URL" field can be a regular expression, and this provide a powerful way to specify complex search patterns for matching URL. The "Skip" field is similar to From URL", it can be a part of URL and contains a regular expression, but it offers a way to skip the rule. When the skip condition matches the rule is discarded. In the next paragraphs will be shown many regular expression examples.
For any request on the site, the ReDJ plugin compares the requested URL with all the rules enabled in the ordering set for rules. The first matching rule found (if there's at least one) is used for redirect.