+ Post New Thread
Results 1 to 6 of 6
*nix Thread, Case Sensitive Apache/Moodle in Technical; I'm having issues with moodle and case-sensitive files on LAMP I received "The National Strategies: Inclusion Development Programme Primary/Secondary" from ...
  1. #1


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    Case Sensitive Apache/Moodle

    I'm having issues with moodle and case-sensitive files on LAMP

    I received "The National Strategies: Inclusion Development Programme Primary/Secondary" from the dfCSF.
    The software is designed for staff inset. Although the software is a windows installer, it is (almost) perfect VLE material - lots of HTML with a few Flash exercises.

    but in the infinite wisdom of the dfCSF they have coded it with a mix of uppercase and lowercase HTML, looking for uppercase and lowercase files.
    They then claim it only works on XP. I can see why.

    Is there a simple way of making apache case insensitive?

    I tried a script that changes file/directorynames to lowercase, but it only partially solved the problem. Anyone fancy sharing something sed/perly that will change my href's to something lowercase?

  2. #2
    Jona's Avatar
    Join Date
    May 2007
    Location
    Cranleigh
    Posts
    471
    Thank Post
    14
    Thanked 51 Times in 49 Posts
    Rep Power
    24
    If you host it under pure apache I suspect this is possible with either mod_spelling or mod_rewrite however if moodle is wrapping the hosting of it these may not work as well and/or may break other things....

    Jona

    Ninja edit: mod_spelling now seems to be known as mod_speling : http://httpd.apache.org/docs/2.0/mod/mod_speling.html

  3. #3


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    I tested it on a apache virtualhost which was running on the same server as the moodle, but it did the same, so I suspect it is more apache than moodle.

    there is a lot of data on our moodle (we've had it for a few years now) and I'm sure that installing mod_rewrite won't work because there are so many files already uploaded, realistically I don't want to rename them all - it's bound to go pear shaped.

  4. #4
    User3204's Avatar
    Join Date
    Aug 2006
    Location
    Wirral
    Posts
    769
    Thank Post
    55
    Thanked 66 Times in 62 Posts
    Rep Power
    34
    Quote Originally Posted by Jona View Post
    ...mod_spelling now seems to be known as mod_speling...
    Apache are taking the p*** aren't they ?
    Trying to be clevar..
    Last edited by witch; 20th March 2010 at 11:42 PM.

  5. #5


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    I just found this excellent post. I think I'll try an butcher a script....

    Re: WC:>: changing anchor filenames to lowercase

    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html

    which says:


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^^^^^
    for every file in this directory whose extension is '.html',


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^^^^
    create a backup copy (with the extension '.bak'), then write the output of
    this command back into the original file. the official term for this is
    "in-place editing", hence the 'i'.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^
    loop through the file one line at a time, printing the results of the
    command (technically, the contents of the "$_" internal variable) before
    going on to the next line.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^
    decide what to print (and thus write back into the file) by executing the
    string which follows. and that string says:


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^
    perform a substitution


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^
    for every occurrence of a matching string (not just the first, as is the
    default), which makes this a 'global' search & replace function.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^
    ignore case when looking for items that match the target pattern.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^^^^^
    the pattern we're looking for starts with the string 'href="'


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^
    followed by any number of characters, of any kind,


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^
    up to the next '"' mark.


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^ ^
    when you find a string of that type, remember it (store it in a temporary
    variable named "$1")


    perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html
    ^^^^
    and replace it with a copy of itself, converted entirely to lowercase.

    after running that, all your URLs should be converted to lowercase in the
    original files, but the backups contain original versions of each file.
    if something goes wrong, you can back up and start again. if the command
    did what you wanted, you can delete all the backup files and be done with
    it.


  6. #6


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    I think this did it.
    will test tomorrow

    Code:
    find ./ -iname "*.html" -exec perl -pi.bak -e 's/(href=".*?")/\L$1/ig;' *.html {} \;

SHARE:
+ Post New Thread

Similar Threads

  1. Sensitive question - using the 'U' code in a register
    By jenny_urey in forum General Chat
    Replies: 2
    Last Post: 8th February 2008, 10:04 AM
  2. Office 2007 file format support in Apache, PHP and Moodle
    By Geoff in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 8th July 2007, 12:12 AM
  3. JISC Moodle Sustainability Case Study
    By Geoff in forum Virtual Learning Platforms
    Replies: 0
    Last Post: 27th June 2007, 11:15 AM
  4. Censornet Case studies please
    By Wizzer in forum *nix
    Replies: 16
    Last Post: 22nd January 2007, 11:28 PM
  5. Case Studies
    By russdev in forum General Chat
    Replies: 2
    Last Post: 4th October 2006, 12:50 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •