Two files to redirect in different format

Discuss practical ways rearrange URLs using mod_rewrite.

Two files to redirect in different format

Postby gairy » Sat Aug 30, 2008 10:22 am

Hi,

It's a simple question, I think. I've searched on the forum but did not get any solutions. So, I'm posting this thread.

My website has pages like /books.php?name=alchemist, vcd.php?name=Titanic, gift.php?name=mug ....

and I want rewrite them in following format:-
/books/alchemist/
/vcd/Titanic/
/gift/mug/

any help will be highly appreciated!!
gairy
 
Posts: 2
Joined: Sun Aug 17, 2008 9:52 am

Postby richardk » Sat Aug 30, 2008 11:27 am

Try
Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteRule ^(books|gift|vcd)/([^/]+)/?$ /$1.php?name=$2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 32 guests

cron