#
# Change the HTTP Servers access rights within my home pages.
#
# Default Server Options are :-
#    Indexes FollowSymLinks IncludesNoExec
#
# Other Options are
#    Indexes                 Generate a directory index if no index.html
#    FollowSymLinks          Follow symbolic links  (and allow rewrite)
#    SymLinksIfOwnerMatch    allow symbolic link if the link and file match
#    ExecCGI                 execute .cgi files for the resulting document
#    Includes                Full server side includes
#    IncludesNoExec          server side includes but don't execute anything
#
Options Indexes IncludesNoExec FollowSymLinks ExecCGI

AddType text/plain .pl

#ErrorDocument 404 /happyerrorpage.html

# Redirect (via URL Rewrite engine) accesses to ONLY www.cit.griffith.edu.au
# redirecting to the new offical web site  http://www.imagemagick.org/Usage/
# Any sub-path and query string is also added to the new URL.
# R = Redirect to external,  L = last rewrite,  QSA = include query string
<IfModule mod_rewrite.c>
RewriteEngine On


# Redirect old to new page - regardless of directory/server location!
#
# Note the follow standard method for directory renames..
#
# RewriteRule   ^olddir(.*)$         newdir$1  [R]
#
# However in per-directory .htaccess files, in a users home directory, it
# fails due to pre ~home expandsion.  That is the prepended filepath is
# incorrect for the redirection.  Usally that is solved by using a
# "RewriteBase", but that does not help if the directory is on multiple
# machine and sub-directorys!
#
# As such the proper solution is to recover the originally requested URI
# path first so that you  can then modify the original request.
#
# The trailing ::: marker is needed due to a weird doubling
# of the trailing path/file that happens on my apache server.
#
# RewriteRule ^olddir/.*$        %{REQUEST_URI}::  [C]
# RewriteRule ^(.*)/olddir/(.*)  $1/newdir/$2      [R,L]

# Relative URI modification -- Independant of what server it is on
RewriteRule ^mosaics/                %{REQUEST_URI}:::  [C]
RewriteRule ^(.*)/mosaics/(.*):::    $1/layers/$2       [R=301,L]

RewriteRule ^manipulate/             %{REQUEST_URI}:::  [C]
RewriteRule ^(.*)/manipulate/(.*)::: $1/convolve/$2     [R=301,L]

# General redirect from the old site, to the offical web site
RewriteCond %{SERVER_NAME} ^www\.ict\.griffith\.edu\.au$
RewriteRule ^(.*)  http://www.imagemagick.org/Usage/$1  [R,L,QSA]

</IfModule>

