Forum Moderators: phranque
I want to use in the cgi the articlecode _and_ the longnamearticlename222
RewriteRule ^/([^_]*)\.html$ /cgi-bin/go.cgi?articlecode111=${icaolist:$1}&name=? [L]
In mod_rewrite I have not found a representation for the longnamearticlename****?
Or is there a trick to work with RewriteCond and $N?
Thank you, Maggi
The goal is to use the codinglist.txt to translate longname to citycode, but to let the cgi-string also transfer the longname to the page.html for usage as a text string.
[example.com...] -> /cgi-bin/go.cgi?citycode=111&longname=Alabama-Downtown
[example.com...] -> /cgi-bin/go.cgi?citycode=111&longname=Alabama-Mystreet
In mod_rewrite I have not found a representation to "catch" the "longname" as the first element in the RewriteMap for a later usage in the cgi string.
Or might I use RewriteCond to catch the "longname" and use $N in the cgi-string?
RewriteCond xyz?
RewriteRule ^/(.*)\.html$ /cgi-bin/go.cgi?citycode=${codinglist:$1}&longname=$N
If the "longname" in your first example incoming URL is "Alabama-Downtown", then I believe that all you need to do is to repeat the $1 in your substitution string:
RewriteRule ^/([^.]*)\.html$ /cgi-bin/go.cgi?citycode=${codinglist:$1}&[b]longname=$1[/b]
The other change I made -- to the regular-expression in the pattern -- is just a speed-up; Avoid using ".*" where possible, because it is often ambiguous and therefore requires more processing time. Rather than saying ".*", meaning "match any number of any character," and then leaving it up to subsequent processing to exclude the ".html" on the end, the expression "[^.]*" means, "match any number of any characters, up to but not including the first period you find." Therefore, this speeds up the pattern-matching a bit in this case.
Jim