I use the following RewriteRule (I have some rewrite conditions above it):
RewriteRule ^page1/([^\ ]+)/?$ - [F]
My intent is for the rule to capture everything after the "page1/" in the $1 variable (which is then used in the rewrite conditions). But I am also trying to strip any trailing / out of the $1 variable (if it exists).
So, I think i am instructing to capture all characters (up to a space - which should not be present) that follow the page1/ but, if a slash is present as the last character, consider it not included within the $1 variable.
The problem is that if a trailing slash is present, it remains included within the $1 variable. I figure that if a trailing / exists it likely gets included in the $1 because it is not a space, and then the /?$ resolves to "zero slashes were present at the end". So, a match is made but with the / in the $1 variable.
I am at a bit of a loss because I want to strip the trailing slash from the variable but not any intermediate slashes which may be present.
Any help on a syntax solution would be greatly appreciated.