phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


mod_rewrite - Part 1: create your "fantasy" URL

Tag: mod_rewrite, url, apache module   Category: Apache
post: 09 Oct 2007 read: 1,803


mod_rewrite tutorial: "Hey, guys! I just hear a fantastic ethnic music at blablabla.com/?cat=312&id=e0347&p=93447", talk Aya to her friends.

mmm... its hard to say (and remmember) that URL. I am sure, you will agree with me. How about if Aya say like this, "Hey, guys! I just hear a fantastic ethnic music at blablabla.com/bestethic.html".

Yes, you can made 'fantasy' URL to instead of dynamic URL.

I know, you are realy 'tee-ou-pee' (read: TOP) build database web application. You can build complex eCommerce. With your skill, its not difficult to understand this URL:


http://www.yoursite.com/cat=02837&subcat=0246&product_id=001

May, you will say:


cat (category) = ethnic (represented: 02837)
subcategory (subcat) = java (represented: 0246)
and
product id (product_id) = gamelan java (represented: 001)

as programming code, its not difficult. But how with your fanatic customer. Its realy difficult if he want to say to his friends about your product in web.

It will be more easy if he can say, blablabla.com/bestethnic.html

How modify dinamic URL to static URL like this? Must we create a page/product? NO!

You can use mod_rewrite in apache to build 'fantasy URL' (I said 'fantasy URL' because its not realy page). You can use that module to create any URL to represent a dynamic page. Look example below:


ethnicmusic.html  = product.php?cat=203&prodid=934746
good-coding.html  = article.php?article_id=2336

Okey, are you ready? lets read another article in this series.



Series this article:
mod_rewrite - Part 1: create your "fantasy" URL
mod_rewrite - Part 2: Instalasi modules in Apache
mod_rewrite - Part 3: build your own "fantasy" URL

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting