url rewriting

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
ronipthomas
Forum Newbie
Posts: 3
Joined: Thu Nov 11, 2010 4:37 am

url rewriting

Post by ronipthomas »

Hi guys..

I want to rewrite my url from http://www.exmpl.com/foo/bar/test/123/ to http://www.exmpl.com/foo/bar/test.php?id=123...

I read many tutorials..

In that they all say about url's like http://www.exmpl.com/foo.php?id=123..

Please help me..
Please post a .htaccess sample file which does this, if possible.
Thanks in advance..
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: url rewriting

Post by josh »

RewriteEngine On
RewriteRule /foo/(.*?) /foo.php?id=$1

now /foo/1 will be rewritten to /foo.php?id=1

First you must understand regex to understand rewrites.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: url rewriting

Post by pickle »

Moved to "Installation and Configuration".
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply