This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Identifying Upper Case Variables
Author
Message |
datacloud
Newbie


Joined: 06 January 2005
Location: United States
Posts: 12
Posted: 25 January 2012 at 7:49am

1) I need to identify the upper case variables for a URL
rewrite.

http://www.site.com/Category-category-name-Class-sub-
category-name-Style-residential-modern-contemporary

If you notice the variable name always starts with a
capital letter.

I would like to transform this call to

http://www.site.com?Category=category-name&Class=sub-
category-name&Style=residential-modern-contemporary

How do you identify the area between the Capital and the
dash?

2) There could be between 1 and 10 variables passed in
this fashion so I need a way parse a variable group. I
know I could write 10 rewrite statements but is there a
way to do do this in less steps.

3) Because this is my base search call I also need to
make sure this call does not have an .htm or .html
ending. how do you check to make sure this does not exist
in your string

Thanks so much...
Back to Top Visit datacloud's Homepage
 
datacloud
Newbie


Joined: 06 January 2005
Location: United States
Posts: 12
Posted: 25 January 2012 at 2:02pm

It looks like a series of rewrite rules will do this. My code can remove the dashes an the variables passed in. I'm wondering if there is a cleaner way to do this.

RewriteRule ^/([A-Z][a-z]*)([-][^A-Z]*)\.htm /search.cfm\?$1=$2     
RewriteRule ^/([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)\.htm /search.cfm\?$1=$2&$3=$4
RewriteRule ^/([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)\.htm /search.cfm\?$1=$2&$3=$4&$5=$6
RewriteRule ^/([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)([A-Z][a-z]*)([-][^A-Z]*)\.htm /search.cfm\?$1=$2&$3=$4&$5=$6&$7=$8

Edited by datacloud - 25 January 2012 at 2:03pm
Back to Top Visit datacloud's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 January 2012 at 4:49am

Hello,

As long as this set of rules works - don't minimize it.
We could, of course, create a more universal rule with loops, but this turns out to be less effective most of the rime.

The condition you're looking for is:

Code:
RewriteCond %{REQUEST_FILENAME} !-f


it checks if the requested URL is NOT a real file.

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version