Jump to content


modrewrite


4 replies to this topic

#1 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 18 August 2008 - 02:36 PM

I have been through the various tutorials on this site and just cant seem to find the answer, so i was wondering if anyone could help me add a second variable to a mod rewrite. I know how to add one, but the second one i just cant seem to get. Heres what i have:

RewriteRule ^forums/newtopic/([0-9]+).*$ forums/newtopic.php?id=$1
but i need it to make this url (www.site.com/forums/newtopic.php?id=ID&action=process)
into (www.site.com/forums/newtopic/ID/process/

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 19 August 2008 - 01:04 AM

Mmmk, so what have you tried? I can tell you this much, depending on what exactly you did, the '.*' at the end there will probably through you off a bit.

Edited by rc69, 19 August 2008 - 01:04 AM.


#3 Blaatzorrr

    Young Padawan

  • Members
  • Pip
  • 24 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Html,CSS,Javascript,PHP&Mysql and more =)

Posted 19 August 2008 - 05:12 AM

RewriteEngine On
RewriteRule ^forums/newtopic/(.*)/process/ forums/newtopic.php?id=$1&action=process

I think this will do it =)

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 19 August 2008 - 11:17 AM

Assuming process is the only action he wants, and any value can be accepted as an id.

I think this would work a bit better (though, '.*' could be used to match the action rather then the limiting values i have):
RewriteRule ^forums/newtopic/([0-9]+)/([a-zA-Z0-9_\-]+)/? forums/newtopic.php?id=$1&action=$2


#5 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 19 August 2008 - 01:03 PM

worked. thanks all!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users