Re: More rewrite rule fun
Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategoriesmodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340203 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: More rewrite rule fun
Nate ok... what's the \w/ for? I'm not seeing that in my list of stuff I can use in the docs. Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Nathan Strutz [mailto:str...@gmail.com] Sent: Wednesday, December 22, 2010 8:53 AM To: cf-talk Subject: Re: More rewrite rule fun Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340204 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: More rewrite rule fun
Nate... that worked I think... here's what I got.. [domain][***] (2) rewrite 'camaro/parts/brakes/pads/' - '/controllerscript.cfm? type=productaction=displayProductCategoriesmodel=camarosubcatpath=brakes/ pads/ I think that will work great... I just have to unpack the path and I'm good eh? Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Nathan Strutz [mailto:str...@gmail.com] Sent: Wednesday, December 22, 2010 8:53 AM To: cf-talk Subject: Re: More rewrite rule fun Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340205 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: More rewrite rule fun
The \w typically means match any word. I think it's allowed in mod_rewrite rules. So this rule says look for /part/ and any word ending in / and find 1 or more of those words ending in / Nate, is that right? Wil Genovese Sr. Web Application Developer/ Systems Administrator 651-894-4238 wilg...@trunkful.com www.trunkful.com On Dec 22, 2010, at 8:57 AM, Mark A. Kruger wrote: Nate ok... what's the \w/ for? I'm not seeing that in my list of stuff I can use in the docs. Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Nathan Strutz [mailto:str...@gmail.com] Sent: Wednesday, December 22, 2010 8:53 AM To: cf-talk Subject: Re: More rewrite rule fun Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340206 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: More rewrite rule fun
Excellent... thanks Wil. Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Wil Genovese [mailto:jugg...@trunkful.com] Sent: Wednesday, December 22, 2010 9:11 AM To: cf-talk Subject: Re: More rewrite rule fun The \w typically means match any word. I think it's allowed in mod_rewrite rules. So this rule says look for /part/ and any word ending in / and find 1 or more of those words ending in / Nate, is that right? Wil Genovese Sr. Web Application Developer/ Systems Administrator 651-894-4238 wilg...@trunkful.com www.trunkful.com nsubscribe.cfm ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340207 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: More rewrite rule fun
Will, that's right. The \w switch is roughly equivalent to [A-Za-z0-9_], aka, letters, numbers and underscores. I put \w/ in there to capture the \w words and / forward slashes. This regex just captures any words slashes after /parts/, which is pretty good because it makes the ending slash optional. If you have other characters in your subcategories (like dashes), you can just add those to the [\w/] char group. You could get fancier, and capture the subcategories individually, but it gets trickier, and making that replacement in CF is so much easier. nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 8:10 AM, Wil Genovese jugg...@trunkful.com wrote: The \w typically means match any word. I think it's allowed in mod_rewrite rules. So this rule says look for /part/ and any word ending in / and find 1 or more of those words ending in / Nate, is that right? Wil Genovese Sr. Web Application Developer/ Systems Administrator 651-894-4238 wilg...@trunkful.com www.trunkful.com On Dec 22, 2010, at 8:57 AM, Mark A. Kruger wrote: Nate ok... what's the \w/ for? I'm not seeing that in my list of stuff I can use in the docs. Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Nathan Strutz [mailto:str...@gmail.com] Sent: Wednesday, December 22, 2010 8:53 AM To: cf-talk Subject: Re: More rewrite rule fun Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340208 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: More rewrite rule fun
Thanks Nate - I have to add '-' and account for ''. Wil Genovese Sr. Web Application Developer/ Systems Administrator wilg...@trunkful.com www.trunkful.com On Dec 22, 2010, at 10:41 AM, Nathan Strutz wrote: Will, that's right. The \w switch is roughly equivalent to [A-Za-z0-9_], aka, letters, numbers and underscores. I put \w/ in there to capture the \w words and / forward slashes. This regex just captures any words slashes after /parts/, which is pretty good because it makes the ending slash optional. If you have other characters in your subcategories (like dashes), you can just add those to the [\w/] char group. You could get fancier, and capture the subcategories individually, but it gets trickier, and making that replacement in CF is so much easier. nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 8:10 AM, Wil Genovese jugg...@trunkful.com wrote: The \w typically means match any word. I think it's allowed in mod_rewrite rules. So this rule says look for /part/ and any word ending in / and find 1 or more of those words ending in / Nate, is that right? Wil Genovese Sr. Web Application Developer/ Systems Administrator 651-894-4238 wilg...@trunkful.com www.trunkful.com On Dec 22, 2010, at 8:57 AM, Mark A. Kruger wrote: Nate ok... what's the \w/ for? I'm not seeing that in my list of stuff I can use in the docs. Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Nathan Strutz [mailto:str...@gmail.com] Sent: Wednesday, December 22, 2010 8:53 AM To: cf-talk Subject: Re: More rewrite rule fun Mark, If your regex ^([^/]*)/parts(/)?$ captures anything after the parts/, you have a bad regex engine. You probably want something like this: ^.*/parts/([\w/]+)$ Using the same replace pattern, you will end up with /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=subcategory1/subcategory2/subcat3 Not sure if that's what you're going for, but a bad response is better than no response from the list ;) nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Wed, Dec 22, 2010 at 7:23 AM, Mark A. Kruger mkru...@cfwebtools.comwrote: Ok regex gurus. here's what I have. I'm using IsapiRewrite (Helicon) on an IIS server. I have links like the following: http://domain/model/parts/subcat1/subcat2/subcat3/subcat4/subcat5 From 1 to 6 levels of sub categories. My rule finds parts and the model .. So I need a rule that gives me the rest of the url (everything after /parts/) and directs it to my controller - which figures out what to display. Here's what I have that works for the first level.. RewriteRule ^([^/]*)/parts(/)?$ /controllerScript.cfm?prodtype=productdisplayaction=displayProductCategorie smodel=$1 [L,QSA] So what do I need to work with subsequent levels. I'm trying to add something to the end of /parts(/)?$ . like (/*) or (/)*? . something that variablizes the rest of the URL .but I'm falling flat. Any rewrite gurus out there know what I'm doing wrong? Will I need a rule for each possible level maybe? -mark Mark A. Kruger, MCSE, CFG (402) 408-3733 ext 105 Skype: markakruger http://www.cfwebtools.com www.cfwebtools.com http://www.coldfusionmuse.com www.coldfusionmuse.com http://www.necfug.com/ www.necfug.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340209 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm