Skip to content

Instantly share code, notes, and snippets.

@sofadesign
Created August 5, 2009 14:43
Show Gist options
  • Save sofadesign/162706 to your computer and use it in GitHub Desktop.
Save sofadesign/162706 to your computer and use it in GitHub Desktop.
<?php
# LIMONADE URL REWRITING EXAMPLE
# In your .htaccess in your app folder
# <IfModule mod_rewrite.c>
# Options +FollowSymlinks
# Options +Indexes
# RewriteEngine on
#
# # if your app is in a subfolder:
# # RewriteBase /my_app/
#
# # test string is a valid files
# RewriteCond %{SCRIPT_FILENAME} !-f
# # test string is a valid directory
# RewriteCond %{SCRIPT_FILENAME} !-d
#
# RewriteRule ^(.*)$ index.php?uri=/$1 [NC,L,QSA]
# # with QSA flag (query string append),
# # forces the rewrite engine to append a query string part of the
# # substitution string to the existing string, instead of replacing it.
# </IfModule>
function configure()
{
option('base_uri', '/');
# option('base_uri', '/my_app'); # '/' or same as the RewriteBase in your .htaccess
}
# GET http://your.new-website.com/
# or http://your.new-website.com/my_app/ if in subfolder /my_app
dispatch('/', 'example_index');
function example_index()
{
}
# GET http://your.new-website.com/my/page
# or http://your.new-website.com/my_app/my/page if in subfolder /my_app
dispatch('/my_page', 'example_page');
function example_page()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment