If you want to tail the errors on another terminal, just push them to a fifo:
$ mkfifo pgerror $ psql -U user dbname < ./dbfile 2> pgerror
On your other terminal:
$ tail -f pgerror
Voila! STDOUT on the main terminal, and STDERR on the secondary.
commandserrorsmkfifopipepsqlredirectshelltailterminal
If you need to fool a machine into believing that a host:port pair is local, you can use ipchains to redirect traffic. For example, the desired destination is www.example.com:80 and you want it to go to localhost:8080:
# echo '1' > /proc/sys/net/ipv4/ip_forward # ipchains -A input -j REDIRECT 8080 -p tcp -s 0.0.0.0/0 -d 0.0.0.0/0 80
Note: No one really uses ipchains anymore, but it can be found on older systems.
commandsfirewallip_forwardipchainsloopredirectshell
To redirect all pages to / with Apache, use mod_rewrite:
RewriteEngine On RewriteRule \/.+ / [L,R]
apacheconfigurationmod_rewriteredirectrewriterules