[plug] Apache - how to make URLs case insensitive.

John Summerfield summer at os2.ami.com.au
Mon Aug 23 20:47:01 WST 1999


> > 
> > Folks,
> > I've installed some Windoze documentation on a Linux server, and some of
> > the links have different case to the actual files.
> >   How can I tell apache to try a case-insensitive match on URLs?
> > I have read the config files and search the docs without success.
> > 
> > cheers,
> > 
> > Mike Holland <mike at golden.wattle.id.au>            Perth, Australia.
> >                           --==--
> > 	I had no shoes and I pitied myself.  Then I met a man who had no
> > 	feet, so I took his shoes.
> > 	                -- Dave Barry
> > 
> > 
> 
> Hmm... there is a spelling module which lets apache search for other
> possible files based on the number of incorrect characters in a bad
> URL... 
> 
> Are all the files in one case...? ie are they all lower-case in the
> filesystem...? if so you could probably use some sort of url filter that
> converts all upper-case to lower-case...

Some creative use of bash, tr, sed & maybe ed will fix the tags; you could 
rename the files themselves to be uniformly lower or upper case.

Here's a script I put together to find the errors; I'm not especially 
interested in taking it further.

#!/bin/bash
D='/u02/java/IBM/ftp/ '
grep -ni "<a .*href=" `find ${D} -name \*.html` \
   | sed -e 's/:.*href="/|/i' -e 's/".*//' -e 's/<a//' -e 's/#.*//' -e 
's/|/ /' | grep '\..*\.' \
   | grep -v http: \
   | sort -u \
   | while  read source link
      do
         fd=`dirname $source`
         EF=$fd/$link
         [ -n "${link}" ] && \
            [ ! -f ${EF} ] && \
            {
               echo EF=${EF}  s=$source d=$fd l=,$link,
               AF=`find ${D} -iname ${link}`
               echo AF=${AF}
               cmd="grep -ni $link $source /dev/null"
#              echo ${cmd}
               ${cmd}
#              grep -i "$link" $source /dev/null
               echo
            }
      done



-- 
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.




More information about the plug mailing list