phpeveryday.com

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


mod_rewrite - Part 3: build your own "fantasy" URL

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


mod_rewrite tutorial: In this tutorial, I will show you how to make "bestethnic.html" to instead "product.php?id=3". Before you read, make sure you have understood part 1 and part 2 from this series.

Assume, you work on www/product (it root folder for www.yoursite.com).

Ok, folow this steps:

1. Create .htaccess on your folder.
2. Write this code:

RewriteEngine On

# translate bestethnic.html to product.php?id=3
RewriteRule ^bestethnic\.html$ product.php?id=3
3. create product.php
4. write this code at product.php

<?php
echo "you have choose product id: #".$_GET['id'];
>

Catch idea?



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
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

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


615
posting