simple problem that I am stuck on

CLOSED

simple problem that I am stuck on

Postby alex_hill » Tue Feb 16, 2010 1:54 am

OK, so I a n00b when it comes to regular expressions, so I am sure this problem is pretty simple.

So far I have a guestbook where I have:

index.php/guestbook/sign --> pages/guestbook.php?action=sign
index.php/guestbook/view --> pages/guestbook.php?action=view

But I also want people to be able to view a single entry by going to:
index.php/guestbook/view/23 --> pages/guestbook.php?action=view&id=23


So far the entry I have is:
RewriteRule ([^/\.]+)/([^/\.]+)/?$ /pages/$1.php?action=$2 [L]

I am having trouble adding the third variable in. I can simply repeat another ([^/\.]+) but this requires some entry to be there, so the first two links dont work anymore.

How can I set this up to that I can use the two vars or three in the situation I need to. I am aiming for a general case because I plan on adding other pages then the guestbook.
alex_hill
 
Posts: 1
Joined: Tue Feb 16, 2010 1:46 am

Return to New Threads/Problems

Who is online

Users browsing this forum: No registered users and 3 guests

cron