Forum Moderators: phranque
What I originally had allowed the following:
/document/title/
/document/title2/
/document/title3
and so forth...
I want to allow all the previous, but also an optional folder, such as:
/document/1/title/
/document/2/title/
/document/2/title2/
Basically, I need to allow characters for a folder, but if there is something, then it is required to have a trailing slash.
What I had:
^document/([0-9a-z_-]+)/?$
What I'm working on:
^document/[([0-9a-z_-]+)/]?([0-9a-z_-]+)/?$
What I have doesn’t seem to work. Any help would be appreciated.
Also, I am passing those folder and title names to a variable in the rewritten url, so I need to keep the parenthesis.
pattern: [([0-9a-z_-]+)/]?
meaning: Match one or more characters, any one of (, [, 0-9, a-z, _, or -", followed by a ")" a "/" and an optional "]".
I suspect you wanted:
^document/(([0-9a-z_\-]+)/)?([0-9a-z_-]+)/?$
Jim