Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite newbie help

mod_rewrite for base, dir, subdir

         

sipkhoon

5:36 pm on Mar 6, 2004 (gmt 0)

10+ Year Member



Hi,

I am new to Apache's mod_rewrite and php. I've tried my best to understand it, but I can't write the codes to suit my needs.

I am trying to make my urls more friendly, in which I have some url like:

/content.php?directory=dir1
/content.php?directory=dir1&page=pg1

How do I write the RewriteRule (and RewriteCond?) on my .htaccess which will function in this way:

both /dir1/ and /dir1 point to /content.php?directory=dir1

and

both /dir1/page1/ and /dir1/page1 point to /content.php?directory=dir1&page=pg1

and

/ (ie, [mydomain.com...] point to /content.php?directory=home

both dir1 and pg1 are variables.

I need some helps from you guys.

Thank you.

--
sipkhoon

closed

5:35 am on Mar 12, 2004 (gmt 0)

10+ Year Member



Welcome to Webmaster World, sipkhoon!

You should at least try taking a stab at it, so I'd recommend that you look through some threads on the topic, modify the code, then if you're stuck, post the code you used as well as the problem you encountered.

sipkhoon

6:19 am on Mar 12, 2004 (gmt 0)

10+ Year Member



Thank you.

I have solved it myself after serching here and there. thanks.

--
sk