Current location: Hot Scripts Forums » Other Discussions » Web Servers » Url Match


Url Match

Reply
  #1 (permalink)  
Old 12-29-08, 04:52 AM
clevy clevy is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Url Match

Hello Developers

I have 4 cases of a url

case 1:
mysite.com/(session_id)
case 2:
mysite.com/action/(session_id)
case 3:
mysite.com/action/(session_id)
case 4:
mysite.com/action/(session_id)/otheraction/otheraction


First i would like to know how i can get every after http://mysite.com slash to http://mysite.com using htaccess.

Then would like to know how i would detect the 4 cases of the url above.

In case 4 it can have any amount of otheractions.

The reason why there is the brackets around session_id is to know the difference with it and the action or otheraction

Any help?
__________________

Last edited by clevy; 12-29-08 at 04:56 AM. Reason: Grammer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-29-08, 10:01 PM
clevy clevy is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Any help please
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 12-30-08, 07:14 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Code:
RewriteEngine On

RewriteRule ^([a-f0-9]{32})$ index.php?PHPSESSID=$1
RewriteRule ^([\w-]+)/([a-f0-9]{32})(?:/([\w-]+)){0,2}$ action.php?PHPSESSID=$2&action=$1&otheraction=$3&otheraction2=$4
Untested, but might work. The values in bold probably need to be adjusted, but I can't help you there.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
regular expression to check file names dberebi PHP 3 11-17-07 01:16 PM
pls help learner understand following: clantron PHP 4 03-14-06 02:28 PM
PHP Regular Expressions Jaffizzle PHP 3 11-05-05 08:02 PM
help with preg_match maddude PHP 25 09-24-05 09:55 PM
Help with part of a PHP code cynebald PHP 3 07-29-05 06:07 AM


All times are GMT -5. The time now is 09:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.