Nowadays each site, giant or small makes use of mod rewrite to get great having a look urls like www.check.com/information/ as an alternative of www.check.com?web page=information. In case you use CMS techniques like WordPress or Drupal it’s really easy. You’ll be able to simply permit this opion and your in a position. But when your are writing you personal packages or web sites it’s an entire different tale. In those cases you wish to have to get grimy with htaccess and stuff, and as chances are you’ll know, that’s now not a amusing factor to do. With this magnificence the wanted htaccess is automaticly generated via an set up script. The remainder of the rewriting is completed via defining the wanted url’s in php.
- Outline routes in an ini document or on your PHP script
- Use other url extensions (php, html, trailing slash, no trailing slash)
- Simple integration
- Retrieve url parameters with variable names
- Set up script to generate htaccess
The right way to use
Beneath you discover a small instance of learn how to use this script. Within the zip is a longer lend a hand document with additional information. That is simply to turn you ways simple it’s to make use of this script.
come with("Routing.php"); $routes['news'] = "information"; $routes['news-item'] = "information/$merchandise"; $routes['profile'] = "profile"; $Information = ModRewriter::Direction($routes);
Retrieve the primary parameter of an url. For instance we open this url www.check.com/information/:
This will likely echo information.
Retrieve a named parameter when as an example the url www.check.com/information/45/ is named:
This will likely echo 45.