Mod Rewriter

by Sitebase

These days every website, big or small uses mod rewrite to get nice looking urls like www.test.com/news/ instead of www.test.com?page=news. If you use CMS systems like Wordpress or Drupal it’s very easy. You can just enable this opion and your ready. But if your are writing you own applications or websites it’s an whole other story. In these cases you need to get dirty with htaccess and stuff, and as you might know, that’s not a fun thing to do. With this class the needed htaccess is automaticly generated by an install script. The rest of the rewriting is done by defining the needed url’s in php.

Features

  • Define routes in an ini file or in your PHP script
  • Use different url extensions (php, html, trailing slash, no trailing slash)
  • Easy integration
  • Retrieve url parameters with variable names
  • Install script to generate htaccess

How to use

Below you find a small example of how to use this script. In the zip is an extended help file with more information. This is just to show you how easy it is to use this script.

include("Routing.php");
$routes['news'] = "news";
$routes['news-item'] = "news/\$item";
$routes['profile'] = "profile";
$Info = ModRewriter::Route($routes); 

Retrieve the first parameter of an url. For example we open this url www.test.com/news/:

echo $Info->Get(0);
This will echo news.

Retrieve a named parameter when for example the url www.test.com/news/45/ is called:

echo $Info->Get("item");
This will echo 45.

$5

Prepaid customers
pay just $3 - how? Prepay Your Account With our deposit system not only will purchasing be much faster, but we’ll also take $2 off the price! Find Out More Price

You must sign in or sign up to purchase this item.

12345 ( 17 ratings )

Purchase 99 purchases

Sitebase

Sitebase

Exclusive Author Item was Featured Author was Featured Author had a Free File of the Month Referred at least one person Sold between 10 000 and 50 000 dollars Bought between 1 and 9 items Belgium
File Types Included
HTML PHP
Item Attributes
Created 4 January 10
PHP Version 5.x
MySQL Version N/A
PHP Framework N/A
Compatible Browsers FireFox 2, FireFox 3, IE6, IE7, IE8, Opera, Safari
PHP Files Included HTML, PHP
Collections that include this item