I'd developed project with custom MVC architecture. And i'm a new comer to Apache world, and so i would appreciate assist with this matter. On the Web I'd found plenty of lessons, but nobody like mine interests.

I've URL such as this: http://knjiskicrv.comoj.com/index.php?page=book&id=1

I must be display such as this: http://knjiskicrv.comoj.com/book/id/1

Or this: http://knjiskicrv.comoj.com/index.php?page=faq Into this: http://knjiskicrv.comoj.com/faq

If there's no page in query (http://knjiskicrv.comoj.com/index.php), I must show: http://knjiskicrv.comoj.com/

Also without any page in query (http://knjiskicrv.comoj.com/index.php?category=2), it ought to be such as this http://knjiskicrv.comoj.com/category/2

Hope someone can help. Thanks.

Really, your condition is really a two step proble. You need to know what's "Routing" in MVC. For those who have your personal implementation of the MVC like framework and also you don't support routing, it most likely means you did not even understand how it labored before. (Sad but true)

Within an MVC framework you setup routes utilizing a ROUTER and also the router analyses the web addresses for you personally saying HEY, i discovered this url that suits your request, proceed and will work by using it.

So then, your controller gets to be a request to route into itself and PARSES the url because he sees fit. For example using explode('/', $_SERVER['REQUEST_URI']) after which reading through aspects of the hyperlink to map to expected variables.

All this is extremely theoretical because you will find Millions of method to implement it inside a custom way. The only real factor you'll have to use is a touch mod_rewrite miracle to pass through all demands for your index.php which will route everything. Consider the url below to discover mod_rewrite, it is a VERY COMPLEX subject:


Things i usually choose however i don't get access to it at home is one thing such as this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^assets/
RewriteRule .* index.php

This can redirect all visitors to index.php and you will then use $_SERVER['REQUEST_URI'] to evaluate the request. My way through assets/ folder won't be touched and work properly.

Note, i built that part off my hat, may possibly not work...