Re: mode_rewrite hostnames and wikiwords

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mike,

Thanks I will give it a go.

On the suggestion of external code, I was going to use the below


#!/usr/bin/perl -w
while (<STDIN>) {
    s/([a-zA-Z0-9]+)/\u\L$1/g;
    s/[^a-zA-Z0-9\n]//g;
    print;
}

but I like the idea of doing it all in the apache config over using the above.

Many thanks again

Phil

On 07/01/2008, Mike Cardwell <apache-users@xxxxxxxxxxxxxxxxxx> wrote:
> Mike Cardwell wrote:
>
> >>> 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]
>
> Actually, on second thoughts, a neater method (avoiding doc2) would be:
>
> RewriteEngine On
> RewriteMap    uppercase int:toupper
> RewriteMap    lowercase int:tolower
> RewriteRule   ^/doc/(.*)$                     /wiki/${lowercase:$1}
> RewriteRule   ^/wiki/(.*?)[^.a-zA-Z0-9]+(.*)$ /wiki/$1$2                [N]
> RewriteRule   ^/wiki/((.*)\.)?([a-z])(.*)$    /wiki/$2${uppercase:$3}$4 [N]
> RewriteRule   ^/wiki/(.*)                     /wiki/$1                  [PT]
>
> They both pretty much work the same though.
>
> 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: users-unsubscribe@xxxxxxxxxxxxxxxx
>   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
>


-- 
Tel: 0400 466 952
Fax: 0433 123 226
email: philwild@xxxxxxxxx

---------------------------------------------------------------------
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: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux