Debt Consolidation - Online Advertising - Web Hosting - Insurance Quotes - Find jobs

PDA

View Full Version : mod_rewrite - I know next to nothing


TwisterMc
Feb 24th 2005, 7:47 pm
Here I go. Learning something new. I want to make a mod_rewrite. :) Basically I have a bunch of dynamic links like this...
page.php?id=1
page.php?id=2
page.php?id=3

Well Google is hating them so i wanna make a script works the same way but the urls would be...
page/1/
page/2/
page/3/

Now I know that mod_rewrite is the way to go, I just don't know much more.

Can anyone help? Or at least point me to a good, not to technical, tutorial. I was at the apache.org site and got information overloaded.

Thanks

honey
Feb 24th 2005, 8:17 pm
Yes, I can help. PM me.

flawebworks
Feb 24th 2005, 8:37 pm
Others would like the answer to this as well.

J.D.
Feb 24th 2005, 8:45 pm
Here's a simple example with test-cgi, so that it's easy to see the query string:

RewriteEngine on
RewriteRule ^test-cgi/([0-9]+)/?$ /cgi-bin/test-cgi?id=$1The part before the space is the regular expression Apache will try to match every request URL to. The regular expression above will match /test-cgi/1 and /test-cgi/1/. Everything that matches the expression inside parenthesis may be put into the resulting URL using $1, $2, etc (positionally):

RewriteRule ^test-cgi/([0-9]+)/([0-9]+)/?$ /cgi-bin/test-cgi?v1=$1&v2=$2This regular expression will match /test-cgi/1/2 and /test-cgi/1/2/.

J.D.

TwisterMc
Feb 25th 2005, 6:51 am
Humm... I'll have to give that a try. Thanks. :) If it doesn't work I'll be back with questions. To bad I won't be able to try it until next week.

TwisterMc
Mar 6th 2005, 1:37 pm
This is what I did


RewriteEngine on
RewriteRule ^product/([0-9]+)/?$ /wrestlingDetails?id=$1


And it didn't work.

Old URL:
http://www.wrestlingpod.com/wrestlingDetails.php?id=58

New URL:
http://www.wrestlingpod.com/product/58/

kyle422
Mar 6th 2005, 1:56 pm
Try this forum. I've found it helpful
mod-rewrite*com/forum/

TwisterMc
Mar 6th 2005, 5:58 pm
I got it!!! Yea!!!