Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use PHP. I want to setup a micro site as a prototype, where I can work with the frontend only, separated from any CMS.

URL Rewrite

I also want the URL rewrite to be correct, like http://www.test.com/products/tables/green/little-wood123/


  1. Is there any free class for URL rewriting? I searched but found none.
  2. If that is not the way to go, what framework is nice for this? It should be tiny, easy to use and support URL rewrite.
share|improve this question
I don't understand what you're describing here. If you need something to deal with rewrites, you presumably have enough documents that something is…managing them. What, in your situation, is that thing? (As a sidenote, you've tagged a question that's supposedly about not using a CMS with the CMS tag. Maybe you're giving yourself a hint.) Pretty much any application framework is going to have a module to handle your URL paths. Barring much more specific requirements, you can probably just pick one. – Su' Oct 2 '12 at 10:26
up vote 5 down vote accepted

There are several PHP microframeworks that allow you to create a simple application with "pretty URLs" by defining the available routes:

For example, this short Limonade app would respond to requests at the root domain (example.com/) and at the specified route (example.com/hello):

require_once 'vendors/limonade.php';
dispatch('/', 'home');
  function home()
      return 'You are home.';
dispatch('/hello', 'hello');
  function hello()
      return 'Hello world!';

All of these frameworks use Apache rewrite rules in .htaccess to direct all requests to your index.php file, which is typically where you define the routes and methods. This is called the "front controller pattern". You could write your own front controller if you don't want to use the frameworks listed above, but there's probably no need to reinvent the wheel if it's a simple application.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.