Here we look at some .htaccess file examples for Livecode server.
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 - revigniter.com
<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 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 apache.org
# Multiple Application servers
If you would like to share a common revIgniter installation to manage several different applications simply put all of the directories located inside your application folder into their own sub-folder - revigniter.com
For example, let's say you want to create two applications, "foo" and "bar". You will structure your application folder like this:
To exclude index.lc and bar.lc from your URLs you need to modify the mod_rewrite rules explained in revIgniter URLs like this: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.lc|bar\.lc|image|img|assets|robots\.txt|css|js|bar) RewriteRule ^(.*)$ index.lc?/$1 [L] RewriteCond $1 !^(bar\.lc|index\.lc|image|img|assets|robots\.txt|css|js) RewriteRule ^bar/?$ bar.lc?/ [L] RewriteRule ^(bar)/(.*)$ bar.lc?/$2 [L] </IfModule>