Good Afternoon:

I am looking to use Apache's mod_rewrite module to rearrange some URLs, but my knoweldge of regular expressions is SORELY lacking.

I would like to take a url such as:

http://www.somesite.com/folder/somepage.html

and translate it to:

http://www.somesite.com/index.php?dept=folder&page=somepage.html

and, just as likely:

http://www.somesite.com/folder/another_folder/somepage.html

to:

http://www.somesite.com/index.php?dept=folder&page=anotherfolder/somepage.html

Would someone please assist me with this? I would greatly appreciate it!

First, configure your servers and virtual servers with mod_rewrite by adding this to apache (I'm assuming you're using apache):

RewriteEngine on
RewriteLog /path/to/logs/server.rewrite.txt
RewriteLogLevel 1

Next, find out which scheme you would like to use for rewrite depending on your comfort zone with apache directives...

http://httpd.apache.org/docs/misc/rewriteguide.html

That should get you where you need to go.

I had gotten that far, but am specifically confused with how to write the regular expresssions to do the URL replacement.