1#!/bin/bash
2
3# This script renames _htaccess files to .htaccess
4# http://doc.tiki.org/Clean+URLs
5#
6# This script was more useful before, because there were many files to rename. More recently, Tiki
7# ships with already named .htaccess files in all subdirectories. Thus, only one file needs to be
8# renamed, the one at the root directory.
9#
10# You can simply rename _htaccess to .htaccess in your root directory, instead of using this script.
11# Nonetheless, the script can be useful if you want to put in a cron job.
12# For example, along with doc/devtools/svnup.sh
13#
14# usage:
15# sh htaccess.sh
16#
17
18OLD=_htaccess
19NEW=.htaccess
20ACTION=activating
21COMMAND="cp"
22
23if [ "$1" = "off" ]; then
24        OLD=.htaccess
25        NEW=_htaccess
26        ACTION=deactivating
27	COMMAND="mv"
28fi
29
30for i in $(find . -name ${OLD}); do
31	chmod 644 $i
32	echo "${ACTION} `dirname $i`/${NEW}"
33	$COMMAND $i `dirname $i`/${NEW}
34done
35