Page 1 of 1
clean url
Posted: Sun Nov 30, 2008 3:54 am
by mainegate
I have read postings that to get a clean url you need to use mod rewrite. I have tried and I'm not getting it. I'm trying to have someone be able to enter
http://localhost/video.php?id=1234 and
http://localhost/video/1234 is displayed in the browser. Anyone have any idea?
I know I could if a file doesn't have an extention then have it by default be a php file. But from what I read it is always best to have the .php on every php file. Right?
Re: clean url
Posted: Sun Nov 30, 2008 4:05 am
by Eran
The best practice (in my opinion) is to use a pattern called
Front Controller. A front controller provides a single entry point into your application, and then determines which script to actually use/include. This is called a dispatch process.
Read the following article on the zend devzone for more details -
http://devzone.zend.com/node/view/id/70
Re: clean url
Posted: Sun Nov 30, 2008 3:27 pm
by jmut
mainegate wrote:I have read postings that to get a clean url you need to use mod rewrite. I have tried and I'm not getting it. I'm trying to have someone be able to enter
http://localhost/video.php?id=1234 and
http://localhost/video/1234 is displayed in the browser. Anyone have any idea?
I know I could if a file doesn't have an extention then have it by default be a php file. But from what I read it is always best to have the .php on every php file. Right?
I think you understand it wrong. In browser you see whatever you type....so approach is you type
http://localhost/video/1234 and then modrewrite will either transform to
http://localhost/video.php?id=1234 or you'll use some router objects like pytrin suggest that will parse the url for you.