I'm creating some alternate urls for pages with mod rewrite. I could
use a little help from someone who knows regular expressions better
than I. I'm using a rewriteMap.
my map looks like this:
mypage  long/ugly/path/to/real/mypage.php
myotherpage  long/ugly/path/to/real/my/other/page.php
It took me a while but I've come up with this rewrite rule:
RewriteRule ^([^/]+)/?$ ${txtmap:$1} [L]
this works if the visitor goes to any of these locations:
http://domain.com/mypage
http://domain.com/mypage/
http://domain.com/myotherpage
http://domain.com/myotherpage/
My problem is coming up with a rewrite rule that will work if the
"slug" contains slashes, while at the same time taking into account
that the user may or may not enter a trailing slash. so if I add this
to my map:
page/one  path/to/page.php?page=1
page/two  path/to/page.php?page=2
I would think this rule would work:
RewriteRule ^(.*)/?$ ${txtmap:$1} [L]
And it does work for this url:
http://domain.com/page/one
but does not match this url:
http://domain.com/page/one/
because the ".*" is gobbling up the trailing slash and not finding it in my map
any suggestions?
Thanks,
Tom Penney