| Author |
|
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 04 July 2008 at 3:37am | IP Logged
|
|
|
Hi there,
I try to transform this:
http://domain/Comment1/Comment2/page/01-02-03-04-05
to
http://domain/index.cfm?page=page&var1=01&var2=02&var3=03&var4=04&var5=05
and if it's possible the number of var can be change, sometimes only 1 var sometimes 2 ...
Thanks.
|
| Back to Top |
|
| |
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 08 July 2008 at 5:36am | IP Logged
|
|
|
Anyone can help me ? Impossible to do ?
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7372
|
| Posted: 08 July 2008 at 3:45pm | IP Logged
|
|
|
Well, this could be done for a fixed maximum number of parameters. For example, for maximum 5 parameters the rule is:
RewriteRule /Comment1/Comment2/([^/?]+)/([^-?]*)(?:-([^-?]*)(?:-([^-?]*)(?:-([^-?]*)(?:-([^-?]*))?)?)?)? /index.cfm\?page=$1(?2&var1=$2(?3&var2=$3(?4&var3=$4(?5&var4=$5(?6&var5=$6:):):):):) [I,L]
Edited by Lexey - 08 July 2008 at 3:45pm
|
| Back to Top |
|
| |
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 09 July 2008 at 4:09am | IP Logged
|
|
|
Thanks a lot Lexey it's perfect.
Mike.
|
| Back to Top |
|
| |
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 09 July 2008 at 6:21am | IP Logged
|
|
|
Hum, now i got a problem :) when i try to insert a image like <img src="/files/images/tn100/file.jpg"> the image don't appeat because of the rule. A solution is possible for that ?
Mike.
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7372
|
| Posted: 09 July 2008 at 7:45pm | IP Logged
|
|
|
http://www.helicontech.com/forum/forum_posts-TID-4740.htm
Edited by Lexey - 09 July 2008 at 7:45pm
|
| Back to Top |
|
| |
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 10 July 2008 at 9:09am | IP Logged
|
|
|
I Already put all of my <img src> the / but he don't care about.
When i have a <im src="/fichiers/img/details/XXXX.jpg"> the img don' t appear, when i look at the debug i can see that he take Fichiers,img,details like a variable so he don't look for a img but for a web page.
Mike.
|
| Back to Top |
|
| |
quarkmike Newbie

Joined: 12 March 2008
Online Status: Offline Posts: 9
|
| Posted: 10 July 2008 at 9:15am | IP Logged
|
|
|
for this example the log tell me that :
PAGE = Images V1 = details/tn100
etc ...
And because page is the condition to change page ... he try to find the images condition.
(i use page variable to include a page like this : if page is 'rubrique' include page rubrique.cfm)
|
| Back to Top |
|
| |
cleo-marc Newbie

Joined: 03 July 2008 Location: United Kingdom
Online Status: Offline Posts: 14
|
| Posted: 10 July 2008 at 10:27am | IP Logged
|
|
|
Lexey wrote:
Well, this could be done for a fixed maximum number of parameters. For example, for maximum 5 parameters the rule is:
RewriteRule /Comment1/Comment2/([^/?]+)/([^-?]*)(?:-([^-?]*)(?:-([^-?]*)(?:-([^-?]*)(?:-([^-?]*))?)?)?)? /index.cfm\?page=$1(?2&var1=$2(?3&var2=$3(?4&var3=$4(?5&var4=$5(?6&var5=$6:):):):):) [I,L] |
|
|
For the benefit of regex numpties like me, can you explain what you're doing, there? I'm having trouble seeing how that works!
__________________ --
Marc
|
| Back to Top |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7372
|
| Posted: 10 July 2008 at 5:08pm | IP Logged
|
|
|
Quote:
When i have a <im src="/fichiers/img/details/XXXX.jpg"> the img don' t appear, when i look at the debug i can see that he take Fichiers,img,details like a variable so he don't look for a img but for a web page.
|
|
|
So, you need a rule to exclude images. For example, like that:
RewriteRule [^?]*\.(?:jpg|gif)(?:\?.*)? $0 [I,L]
Quote:
For the benefit of regex numpties like me, can you explain what you're doing, there? I'm having trouble seeing how that works! |
|
|
This rule captures optional variables into submatches $2, $3, etc Then they are being checked for non-emptiness and added to an output.
|
| Back to Top |
|
| |