revIgniter URLs

By default, URLs in revIgniter are designed to be search-engine and human friendly. Rather than using the standard "query string" approach to URLs that is synonymous with dynamic systems, revIgniter uses a segment-based approach:

example.com/news/article/my_article

Note: Query string URLs can be optionally enabled, as described below.

URI Segments

The segments in the URL, in following with the Model-View-Controller approach, usually represent:

example.com/controller/handler/ID
  1. The first segment represents the controller script that should be invoked.
  2. The second segment represents the controller handler, that should be called.
  3. The third, and any additional segments, represent any variables that will be passed to the controller.
    These segments are not, as one might think, bound to specific parameters of any handlers.

 The URI Library and the urlHelper contain handlers that make it easy to work with your URI data. In addition, your URLs can be remapped using the URI Routing feature for more flexibility.

Removing the index.lc file

By default, the index.lc file will be included in your URLs:

example.com/index.lc/news/article/my_article

You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" method in which everything is redirected except the specified items:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(index\.lc|image|img|assets|robots\.txt|css|js)
  RewriteRule ^(.*)$ index.lc?/$1 [L]
</IfModule>

In the above example, any HTTP request other than those for index.lc, images, assets, robots.txt, css and js is treated as a request for your index.lc file. If you use this method to remove the page, set the Index File variable in your application/config/config.lc file so that it is blank.

If your default controller is not loaded when the URI contains no data please read about URIs in your application/config/config.lc file and choose another protocol to retrieve the URI string.

Note: Adapt RewriteBase to the path to revIgniter. Typically this is /. If you place revIgniter into a subfolder, RewriteBase would be something like /yourSubfolder/yourOtherSubfolder/.

Note: To enable the rewrite engine for .htaccess files you need to set "RewriteEngine On" and "Options FollowSymLinks" must be enabled in the Apache server configuration (httpd.conf) file. See http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Adding a URL Suffix

In your application/config/config.lc file you can specify a suffix that will be added to all URLs generated by revIgniter. For example, if a URL is this:

example.com/index.lc/products/view/shoes

You can optionally add a suffix, like .html, making the page appear to be of a certain type:

example.com/index.lc/products/view/shoes.html

Enabling Query Strings

In some cases you might prefer to use query strings URLs:

index.lc?c=products&m=view&id=345

revIgniter optionally supports this capability, which can be enabled in your application/config/config.lc file. If you open your config file you'll see these items:

put FALSE into gConfig["enableQueryStrings"]
put  "c" into gConfig["controllerTrigger"]
put "h" into gConfig["handlerTrigger"]

If you change "enableQueryStrings" to TRUE this feature will become active. Your controllers and handlers will then be accessible using the "trigger" words you've set to invoke your controllers and handlers:

index.lc?c=controller&h=handler

Using Secure URLs (https) Along with Normal URLs (http)

In case you use secure URLs along with normal URLs you need to set the "Base Site URL" in your application/config/config.lc file to empty like:

put "" into gConfig["baseUrl"]

If gConfig["baseUrl"] is empty revIgniter will guess the protocol, domain and path to your installation.