0

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!

2
Contributors
2
Replies
3
Views
13 Years
Discussion Span
Last Post by apparition668
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.