...
- Offer a friendly url string (that requires no prefix) that when typed after your domain name will be replaced with the relevent objectid from your application
- Provide a URL syntax that allows you define the type, objectid, template view and body view webskins
Part 1.
...
Configure the Web Server
In order to have FarCry process friendly urls, you must have your web server configured to rewrite the URL syntax. Below are web server configuration options for both Apache web server and IIS.
Option A
- For Apache: mod_rewrite (free)
...
Code Block |
---|
##### APACHE MOD_REWRITE SYNTAX RewriteEngine On RewriteCond %{REQUEST_URI} !(^/farcry|^/webtop|^/flex2gateway|^/flashservices|^/cfide)($|/) RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\ \(\)\^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA] |
Option B
- For IIS: ISAPI_Rewrite 3 (or better) (not free, but suggested for IIS) - This is a mod_rewrite compatible module for IIS
...
Code Block |
---|
<VirtualHost mydomain.com www.mydomain.com> ##### APACHE MOD_REWRITE SYNTAX RewriteEngine On RewriteCond %{REQUEST_URI} !(^/farcry|^/webtop|^/flex2gateway|^/flashservices|^/cfide)($|/) RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\ \(\)\^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA] </VirtualHost> |
Option C
- For IIS: Ionic's Isapi Rewrite Filter (free)
Place the following in your INI file
Warning |
---|
Note: There have been reports of people having issues getting the Ionic Asapi Rewrite Filter to work in FarCry 5.1+. If you are successful in getting it to work, please share your comments so that others may benefit |
Code Block |
---|
##### IONIC ISAPI REWRITE SYNTAX RewriteCond %{QUERY_STRING} ^(.*)$ RewriteCond %{REQUEST_URI} !(^/farcry|^/webtop|^/flex2gateway|^/flashservices|^/cfide)($|/) RewriteRule ^(.*)$ /index.cfm?furl=$1&%1 |
Sub-directory Config Example
If you are using a sub-directory installation of FarCry, here is an example of how you would set up the RewriteRule. Notice that the RewriteRule specifies the sub-directories at the start, and redirects to that sub-directory in the rewrite. These sub-directories are also included in the rewrite exception for the webtop (optional - if you want to have webtop aliases under each sub-directory rather than just from the webroot). If you have other exceptions you will need to update those as well.
Code Block |
---|
##### APACHE MOD_REWRITE SYNTAX RewriteEngine On RewriteCond %{REQUEST_URI} !(^/farcry|^/webtop|(subdirectory1|subdirectory2)/webtop|^/flex2gateway|^/flashservices|^/cfide)($|/) RewriteRule ^/(subdirectory1|subdirectory2)([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\ \(\)\^_`~]*)$ /$1/index.cfm?furl=$2 [L,PT,QSA] |
What Does The RewriteRule Actually Do?
Info |
---|
The RewriteRule essentially redirects the request to index.cfm where any url (starting from the webroot) does not include a "." in it (ie, index.cfm, main.css, fotm.js) and not under the folders specified in the exception (/farcry, /webtop, /flex2gateway, /flashservices). Placing the carrot ^ before each exception (optional) specifies that the folder is directly under the webroot. You can omit the carrot in cases where folder exceptions may not lie directly under webroot. |
...
On the page request, the farFU table is searched for the url.furl attribute. If it is found, then the url.objectid is populated with the relevent objectid just like prior to 5.1
Part 2. URL Syntax (type, objectid, view, bodyView)
As of FarCry 5.1 you can use the following url syntax as a friendly url string and if the specific friendly url string is not found in the database, it is converted to the standard url parameters most often used to access content in the system.
...
If you only pass 1 webskin name, then it is placed in the url.view attribute and the url.bodyView will be set to the default (displayBody)
Part 3. Test and Deploy
Test that the Web Server is Configured Correctly for Friendly URLs
Verifying that FarCry can recognize if friendly urls are working correctly is easy. Just append the string /pingFU
to your website (e.g. http://localhost/pingFU or http://localhost/sub-directory/pingFU (if using a sub-directory installation of FarCry)). You should see the the following message on the screen: PING FU SUCCESS. You do not need to update your application scope to run this test, however, once it's working for the first time, you'll want to update the application scope (?updateapp=1) so that FarCry can register the new functionality.
Part 4. Helpful Tips and Troubleshooting
Importing Friendly URLs When Upgrading to FarCry 5.1
...