CodeCanyon - Mod Rewriter
Category: Plugins/Modules
- views: 3 973
- date: 14 July 2011
- posted by: italiantorrent

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);
$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.
DO NOT POST MIRRORS PLEASE
We need your support!
Make a donation to help us stay online
Bitcoin (BTC)
bc1q08g9d22cxkawsjlf8etuek2pc9n2a3hs4cdrld
Bitcoin Cash (BCH)
qqvwexzhvgauxq2apgc4j0ewvcak6hh6lsnzmvtkem
Ethereum (ETH)
0xb55513D2c91A6e3c497621644ec99e206CDaf239
Litecoin (LTC)
ltc1qt6g2trfv9tjs4qj68sqc4uf0ukvc9jpnsyt59u
USDT (ERC20)
0xb55513D2c91A6e3c497621644ec99e206CDaf239
USDT (TRC20)
TYdPNrz7v1P9riWBWZ317oBgJueheGjATm
Information |
|||
![]() |
Users of GUESTS are not allowed to comment this publication. | ||









