WorldWideScripts.net Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Navigation

Mod Rewriter

— Add-On to WorldWideScripts.net

Subscribe to our feed to stay up to date!

New! Follow us as you want it!


Mod Rewriter - CodeCanyon Item for Sale

Ads

Ad: Bluehost hosting

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.


Download
Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers

Properties

Created:
4 January 10

Last Update:
N/A

Compatible Browsers:
Firefox, IE6, IE7, IE8, Opera, Safari

Software Version:
PHP 5.x, jQuery

Software Framework:
N/A

Files Included:
HTML, PHP

Keywords

eCommerce, All Items, clean url, htaccess, links, mod rewrite, rule, seo