: 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
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.
More posts by @Nimeshi995
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.