Dragon wrote:
hit a snag
how would I expand this rule to capture and convert the following?
your.host.name -> YourHostName (works with rule)
YOUR.HOST.NAME -> YourHostName (currently not handled)
Yo-ur.HOST.name -> YourHostName (currently not handled)
effectively the spec would be to take /doc/FQDN (regardless of case
presented)
and capitaliseing every dot separated word returning
/doc/FullyQualifiedDomainName removing any characters other than
[A-Z][a-z][0-9]
RewriteEngine On
RewriteMap uppercase int:toupper
RewriteMap lowercase int:tolower
RewriteRule ^/doc/(.*)$ /doc2/${lowercase:$1}
RewriteRule ^/doc2/(.*?)[^.a-zA-Z0-9]+(.*)$ /doc2/$1$2 [N]
RewriteRule ^/doc2/((.*)\.)?([a-z])(.*)$ /doc2/$2${uppercase:$3}$4 [N]
RewriteRule ^/doc2/(.*) /wiki/$1 [PT]
If I were to do something like this, I would most likely use the
RewriteMap directive to pass the incoming URL to a short Perl script to
do the transformation. The stdin file handle presents the program with
the request URL and you pass the result back via the stdout file handle.
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap
See the section on the page linked above entitled "External Rewriting
Program" for details and a skeleton Perl script you can add your
processing to.
IMO, you should only use external rewrite programs as a last resort. If
you can use the inbuilt apache functions you should do so.
Regards,
Mike
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]