User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 26 Jun 2005, 10:30   #1
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
Mod_rewrite

hi been struggling with this problem for a little while,


basically i want to re direct a url as the current server i use is a little over used and i wish to use another
the problem is that the s`cripts are different and i only need the end bit of the previous url.

i use

ReWriteEngine On
RewriteBase /directory/
ReWriteRule perlscript.pl/(.*)/(.*) http://www.someurl.com/newphpscript.php?var=$2

it works fine until the second variable has a / in it
i need everything after the second slash and was hoping one of you guys and gals could help me out.

Would be great

Thanks
__________________
CaShY
CaShY is offline   Reply With Quote
Unread 26 Jun 2005, 17:50   #2
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: Mod_rewrite

Replace the first (.*) with ([^/]*), so it matches like (b)/(c/d) instead of (b/c)/(d) sort of thing.

.* is "greedy"; here's the relevant paragraph from the regex man page:
Quote:
In the event that an RE could match more than one substring of a given
string, the RE matches the one starting earliest in the string. If the
RE could match more than one substring starting at that point, it
matches the longest. Subexpressions also match the longest possible
substrings
, subject to the constraint that the whole match be as long
as possible, with subexpressions starting earlier in the RE taking pri‐
ority over ones starting later. Note that higher-level subexpressions
thus take priority over their lower-level component subexpressions.
__________________
#linux

Last edited by queball; 26 Jun 2005 at 18:01. Reason: formatting
queball is offline   Reply With Quote
Unread 26 Jun 2005, 21:52   #3
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
Re: Mod_rewrite

nice one queball for that improved the situation but hasn't completely solved it


nm

Thanks Though
__________________
CaShY
CaShY is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 07:55.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018