Redirecting a web site
I was moving a web site from my ISP, which just serves plain HTML pages, to my own server, where I have full control. This shell script replaces all HTML pages on the old web site by a redirect to the new web site (and saves a copy of the old page).
#!/bin/sh
site=\"http://www.example.com\"
for file in $*
do
mv $file $file.bak
cat > $file << XXXXXX
<html>
<head>
<meta name=\"robots\" content=\"noindex\">
<meta http-equiv=\"refresh\" content=\"5; URL=$site/$file\">
</head>
<body>
<p align=\"center\">The page you are looking for is not here. Try:</p>
<p align=\"center\">
<a href= \"$site/$file\">$site/$file</a></p>
<p align=\"center\">If you are not redirected automatically within a few second
s then please click on the link above.</p>
</body>
</html>
XXXXXX
chmod 644 $file
done