A typical Orqi url will look something like this with mod_rewrite enabled ..
http://telephotos.co.uk/photo/latest.html
… or like this with mod_rewrite disabled
http://telephotos.co.uk/index.php?object=photo&action=latest
Note that they both go to the same page. What is happening is the Orqi Loader is receiving the object and action parameters and then using them to look for a controller. First it will look in your nominated “_classes/_app” folder, then it will look in your nominated “_orqi/_app” folder for a default controller. If it can’t find one then an error is returned to the screen of the ilk “Error: Class PhotoController not found.”
The object parameter is the name of the controller and action is the name of the function in the controller. In the example above, this means Orqi will be looking to execute a function called “Latest” in a class called “PhotoController” which is in a file called “PhotoController.php”.
Enable mod_rewrite
If you look in the config.php file you will notice a line like this …
$this->app['mod_rewrite'] = true;
Set it to true to enable the nicer URL writing. Orqi will also produce nice URLs in functions like Controller::MakeLink()
NB: You MUST have the mod_rewrite module loaded on your webserver
.htaccess
Here is like the most basic .htaccess file you can get away with. It’s here where the urls are redirected from “/niceurl/mycommand.html” to “/index.php?object=aargh&action=horridurl”.
RewriteEngine on
RewriteRule ^pages/(.*).html$ index.php?object=page&action=view&id=$1&%{QUERY_STRING} [L]
RewriteRule ^(.*)/(.*).html$ index.php?object=$1&action=$2&%{QUERY_STRING} [L]
The File Extensions
If you want to change the url extensions in your urls just look for the following line in your config.php. The file extension in your config file must agree with the file extensions in your .htaccess file.
(My advice is leave it as html. I was using .orqi for a while before I realised it was an SEO suicide move)
$this->app['extension'] = 'html';
Tags: .htaccess, controller, file extensions, mod_rewrite, url