Mobile app version of vmapp.org
Login or Join
Nimeshi995

: PHP URL Rewrite engine for small project 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

@Nimeshi995

Posted in: #Cms #Php #UrlRewriting

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 www.test.com/products/tables/green/little-wood123/
Question(s)


Is there any free class for URL rewriting? I searched but found none.
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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

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


Slim
Flight
Limonade
Glue


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

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


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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme