Simple Mod Rewite newbe

I am learning mod rewrites and finding it difficult where to start.

If someone can show me sample code for the following, I think that will help:

(1) Simple redirect when they enter www.site.com/view.html to view the page on the server: www.site.com/pages/view.php

(2) Simple redirect like 1 but to append a variable. So they enter www.site.com/jim-brown and I want it to use www.site.com/profile.php?nm=jim-brown

I know most people will say I need to learn it myself but this will help me start.

JS,

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK

No, it’s not helpful. There’s too much. Thanks anyway though.

I just want to learn the basics and expand on that over the next few years.

I’ve seen on another, very simple, tutorial that this redirects one file to another:

RewriteRule ^fileone.html$ filetwo.html

  • but I need to know how to do this:

RewriteRule ^{filename}/{variable}$ {filename}.html?var={variable}

I like to learn the basics first one step at a time.

Thanks for taking the time to respond though.

js,

I have a history of NOT posting code until someone at least makes an attempt. However, let’s say that your pseudo code is “close enough for government work.”

I’m a bit confused that you say you’d like to learn the basics one step at a time but found the long tutorial too much. I tried to “take it one step at a time” and used a LOT of sample code to help the reader along. Okay, this is the first time someone’s not come back with “that’s exactly what I needed” so any comments (other than length, too much information, not precisely the coding samples I need) would be appreciated.

Regards,

DK