parsed.org

Tips by tag: redirect

FIFOs Are Great by xinu on Jan 12, 2005 10:52 AM

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
Ipchains Loop by xinu on Sep 28, 2005 10:57 AM

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
Redirect All Pages To Root by cygnus on Feb 27, 2007 12:16 PM

To redirect all pages to / with Apache, use mod_rewrite:

RewriteEngine On
RewriteRule \/.+ / [L,R]
apacheconfigurationmod_rewriteredirectrewriterules
RSS