Hyphens in my soup

Sep 15, 2008 at 9:15 PM
Edited Sep 16, 2008 at 3:20 PM
[update 9.16.08]
Nevermind. I think I have it figured out. Must have been something funky with my INI file or something.

FYI I'm using this rule which seems to work in all three situations:

RewriteRule ^/([\w-]+)/(?:(\d+)/)?(?:[^/]*/)?$ /_pages/default.asp?sctn=$1&id=$2 [I,L]

And the kicker? I was changing a local ini file and never pushing it to my test server!!! What a dolt am I! Ha! No wonder I was never seeing changes.


Hi guys. Usually I'm responding to people's issues but I need to post one of my own. It's probably pretty simple but I'm not having any luck.

I have a url such as:


My rule to rewrite is:

RewriteRule ^/([\w-]+)/(?:(\d+)/)?(?:.*)?$ /_pages/default.asp?sctn=$1&id=$2 [I,L]

Mainly I care about the first 2 items. The third group is disregarded since it's not used in the rewrite.

1: usually a word forms with the occational hyphen
2: always a digit but I'd like to ignore it if not found
3: always ignored. can be anything but typically in format of "some_text_here". would not be present if 2 is not.

I'm trying to avoid having to write three rules for each successive section.

The issue I'm having is if I have a URL such as:

"/markets/123/some_text/" it works fine

But if I have a urls such as:

"/markets/123/some-text/" it fails.

What the heck am I missing or doing wrong? Is IIRF choking on the hyphen even if I'm calling for ".*"

Thoughts? Ideas?
Sep 16, 2008 at 9:15 PM

glad you figured it out!