
These Days each website online, massive or small makes use of mod rewrite to get appealing urls like www.test.com/news/ rather than www.test.com?page=information. in the event you use CMS techniques like Wordpress or Drupal it’s really easy. you'll just permit this opion and your ready. but if your are writing you own packages or internet sites it’s an whole different story. In these cases you need to get grimy with htaccess and stuff, and as you could recognise, that’s no longer a a laugh factor to do. With this elegance the needed htaccess is automaticly generated by way of an install script. the rest of the rewriting is done by defining the wanted url’s in php.
Features
- Outline routes in an ini record or on your PHP script
- Use other url extensions (php, html, trailing slash, no trailing cut down)
- Easy integration
- Retrieve url parameters with variable names
- Install script to generate htaccess
the way to use
Under you find a small example of ways to use this script. within the zip is a longer assist document with additional information. this is just to display you ways easy it's to use this script.
come with("Routing.php"); $routes'news' = "news"; $routes'news-item' = "information/\$merchandise"; $routes'profile' = "profile"; $Data = ModRewriter::Direction($routes);Retrieve the first parameter of an url. for instance we open this url www.test.com/news/:
echo $Data->Get(0); This Will echo news.Retrieve a named parameter whilst for instance the url www.test.com/news/FORTY FIVE/ is named:
echo $Information->Get("merchandise"); This Will Likely echo FORTY FIVE.FULL DOWNLOAD
No comments:
Post a Comment