Pages

Thursday, January 22, 2009

Web hosting with Apache and laziness.

For a while I had been ignoring a niggling little issue with my home hosted web site at http://www.richardriley.net. When you entered the web address the url actually served was http://www.richardriley.net/default. Finally I found a straightforward explanation of virtual hosts and using redirect matching which all came together and worked. Here is the link.

1 comment:

  1. been a apache sys admin 1998 to 2002 for in house app that's used by tens or hundreds of e-stores. Its config and doc is the worst in unix possible.

    if you site is hosted, to redirect, usually all you have to do is to add lines in a file named “.htaccess”. e.g. here's some lines from my current config:

    RewriteEngine on

    # deal with my moving files or reorg
    # RewriteCond 1 1
    RewriteRule ^Periodic_dosage_dir/20031107_hiphop.html$ http://xahlee.org/Periodic_dosage_dir/sanga_pemci/hiphop.html [L]

    # block image leechers
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.xahlee.org.+|^http://xahlee.org.+$ [NC]
    RewriteRule \.(png|gif|jpg|jpeg|mov|mp3|wav|ico)$ - [NC,F]

    # forbid bots that whack entire site
    RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro|webreaper.net|Missigua|HTTrack|WebCopier|Microsoft\ URL\ Control|Indy\ Library|WebCapture
    RewriteRule ^.+$ - [F,L]

    ReplyDelete