tag:blogger.com,1999:blog-59413252008-09-06T07:33:15.152+01:00Deflexion.comdeflexion & reflexion from nancy mcgoughNMnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5941325.post-13243334845936714452008-03-26T12:34:00.012Z2008-05-27T20:08:20.589+01:00htaccess excerpts and notesHere are some excerpts from my <a href="http://httpd.apache.org/docs/trunk/howto/htaccess.html">.htaccess files</a>. I'm posting these because I often need to remember the syntax of these commands and it's easier to look at the commands here on my blog than to ssh to my <a href="http://www.dreamhost.com/r.cgi?43299">DreamHost</a> or <a href="http://viaverio.com/">Verio</a> web-hosting account and look at them there. Also, I hope these excerpts and notes will be useful to others.<br /><br /><b><i>Note:</i></b> In the code below, a line that begins with a single hash (<code>#</code>) is code that is commented out and a line that begins with two hashes (<code>##</code>) is a comment about the code.<br /><br /><b><big>Used Everywhere</big></b><pre>## Block viewing of .htaccess files<br /><Files .htaccess><br /><tt> </tt> order allow,deny<br /><tt> </tt> deny from all<br /></Files><br /><br />## Do not let IP address xxx.xxx.xxx.xx access (GET) the site<br />## Uncomment these 5 lines if someone or something is abusing the site<br />## Note: 'GET' can be replaced by 'GET POST PUT'<br /># <Limit GET><br /># <tt> </tt> order allow,deny<br /># <tt> </tt> allow from all<br /># <tt> </tt> deny from xxx.xxx.xxx.xx<br /># </Limit><br /><br />## If a directory is requested, do not list the files in the directory<br /><a href="http://httpd.apache.org/docs/trunk/mod/core.html#options">Options</a> -Indexes<br /><br />## Next is sometimes needed, but might already be set in the server configuration<br /># <a href="http://httpd.apache.org/docs/trunk/mod/core.html#adddefaultcharset">AddDefaultCharset</a> UTF-8<br /><br />## Next is needed if you use Rewrite rules<br />## (examples of RewriteCond and RewriteRule are in the sections below)<br />RewriteEngine On<br /><br />## Next Rewrite option is often already set in the server configuration<br />## Uncomment if Rewrite rules don't work<br /># Options +FollowSymLinks</pre><br /><br />The next sections include examples that use the Apache mod_rewrite module. If they seem confusing, it's because they are! As <a href="http://en.wikipedia.org/wiki/Brian_Behlendorf">Brian Behlendorf</a>, one of the primary developers of the Apache web server, said: <blockquote><big>“</big>The great thing about mod_rewrite is it gives you all the configurability and flexibility of <a href="http://en.wikipedia.org/wiki/Sendmail">Sendmail</a>. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.<big>”</big></blockquote>This quote, along with some other good quotes, is on the <a href="http://httpd.apache.org/docs/">Apache Documentation</a> <a href="http://httpd.apache.org/docs/trunk/rewrite/">mod_rewrite</a> page.<br /><br /><br /><big><b>Used at Deflexion.com</b></big><pre>## Specify the <a href="http://www.iana.org/assignments/media-types/">MIME type</a> of unknown file extensions<br />## This is needed because <a title="Blogger permalinks seem permanent, but are they?" href="http://deflexion.com/2005/11/blogger-permalinks-seem-permanent-but">I use extensionless URLs at Deflexion.com</a><br />## If default is HTML, use:<br /># DefaultType text/html<br />## If default is PHP, use:<br /><a href="http://httpd.apache.org/docs/trunk/mod/core.html#defaulttype">DefaultType</a> application/x-httpd-php<br /><br />## If URL points to a directory, serve the first of these files that exist<br /><a href="http://httpd.apache.org/docs/trunk/mod/mod_dir.html#directoryindex">DirectoryIndex</a> index index.php index.html index.<a href="http://atomenabled.org/">atom</a><br /><br />## PHP include files are located in this directory<br />php_value include_path "/path/i/do/not/want/to/publish/on/my/blog/_shared"<br /><br />## If 'http://deflexion.com/index' is requested, remove 'index'<br />## The goal is to get people & machines to link to 1 & only 1 URL for this page<br />## Details at Wikipedia's <a href="http://en.wikipedia.org/wiki/URL_normalization">URL normalization</a> (aka URL canonicalization)<br />## Another examples of URL canonicalization is in the Infinite Ink section below<br />## Note: '^[A-Z]{3,9}\ /' matches GET POST PROPFIND etc, followed by space slash<br />## This RewriteCond avoids infinite loops<br /><a href="http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html#rewritecond">RewriteCond</a> %{THE_REQUEST} ^[A-Z]{3,9}\ /index\ HTTP/<br /><a href="http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html#rewriterule">RewriteRule</a> ^index$ http://deflexion.com/ <a href="http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html#rewriteflags">[R=301,L]</a><br /><br />## <a href="http://en.wikipedia.org/wiki/URL_redirection">Redirect this URL</a>-path to the current URL<br /><a href="http://httpd.apache.org/docs/trunk/mod/mod_alias.html#redirect">Redirect</a> permanent /messaging/blogs/ <a title="Just What is a Blog? Atomizing, Distributing, and Re-Forming Content" href="http://deflexion.com/2004/01/just-what-is-blog-atomizing">http://deflexion.com/2004/01/just-what-is-blog-atomizing</a><br /><br />## For details about these RedirectMatch lines, see<br />## <a href="http://deflexion.com/2008/03/twitter-tinyurl-dots-dashes-and-my">Twitter, TinyURL, Dots, Dashes, and My htaccess File</a><br />## Note: The order of these 5 RedirectMatch lines matters!<br /><a href="http://httpd.apache.org/docs/trunk/mod/mod_alias.html#redirectmatch">RedirectMatch</a> 301 ^/(2008/../[^.]*)\.([^.]*)\.([^.]*)\.([^.]*)\.([^.]*)\.([^.]*)$ http://deflexion.com/$1-$2-$3-$4-$5-$6<br />RedirectMatch 301 ^/(2008/../[^.]*)\.([^.]*)\.([^.]*)\.([^.]*)\.([^.]*)$ http://deflexion.com/$1-$2-$3-$4-$5<br />RedirectMatch 301 ^/(2008/../[^.]*)\.([^.]*)\.([^.]*)\.([^.]*)$ http://deflexion.com/$1-$2-$3-$4<br />RedirectMatch 301 ^/(2008/../[^.]*)\.([^.]*)\.([^.]*)$ http://deflexion.com/$1-$2-$3<br />RedirectMatch 301 ^/(2008/../[^.]*)\.([^.]*)$ http://deflexion.com/$1-$2<br /><tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> ^^^<br /><tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> '301' is equivalent to 'permanent'<br /></pre><br /><br /><big><b>Used at Infinite Ink</b></big><pre>## If the requested hostname is anything other than www.ii.com,<br />## rewrite it to www.ii.com<br />RewriteCond %{HTTP_HOST} !^www.ii.com$ <!-- [NC] --><br />RewriteRule (.*) http://www.ii.com/$1 [R=301]<br /><br />## Remove trailing 'index.html' from requested URLs<br />## See Note above about the regular expression '^[A-Z](3,9}\ /'<br />RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/<br />RewriteRule ^(([^/]+/)*)index\.html$ http://www.ii.com/$1 [R=301,L]<br /><br />## Redirect this local URL-path to the current URL<br />Redirect permanent /communicate <a title="Make a Meta Comment" href="http://deflexion.com/2005/12/make-meta-comment">http://deflexion.com/2005/12/make-meta-comment</a></pre><br /><!-- http://www.organicseo.org/URL_Rewriting.html http://www.webmasterworld.com/apache/3311558.htm http://hecker.org/site/uri-rewriting http://www.asrvision.com/web-design-tutorials/htaccess-tutorial.htm /http://hecker.org/site/uri-rewriting --><br />Comments, suggestions, and questions are welcome!NMnoreply@blogger.comtag:blogger.com,1999:blog-5941325.post-1170179180866201992007-01-30T17:45:00.002Z2008-08-27T15:35:30.120+01:00Building and Installing Alpine (Apache-Licensed Pine)Alpine, the University of Washington's new Apache-Licensed Pine, has been in alpha testing since 2006 November 29 and it's now at a point where I feel comfortable recommending it to <a href="http://www.ii.com/internet/messaging/pine/pc/">power Pine</a> users. If you would like to participate in the alpha test, go to the <a href="http://www.washington.edu/alpine/">Alpine Information Center</a> and join the <a href="https://mailman2.u.washington.edu/mailman/listinfo/alpine-alpha">alpine-alpha mailing list</a>.<br /><br />Here is what I did to build and install Alpine on my Mac OS X system.<br /><ol><li>If you have not done so already, download and install the latest <a href="http://developer.apple.com/tools/xcode/">Xcode package</a> from the <a href="http://developer.apple.com/macosx/">Apple Developer Center</a>.<br /></li><li>Backup any Pine and Alpine files that are in <code>/usr/local/bin</code>. These will be replaced by Step 13 below.<br /></li><li>Go to <a href="ftp://ftp.cac.washington.edu/alpine">ftp.cac.washington.edu/alpine</a> and get the latest alpine-x.xx.tar.bz2 (where x.xx is the version number). I prefer to get the .bz2 file because it is smaller than the .Z and .gz files.<br /></li><li>Put this <a href="http://en.wikipedia.org/wiki/Tar_%28file_format%29">tarball</a> in your build directory, for example in ~/Build.<br /></li><li>Open a <a href="http://en.wikipedia.org/wiki/Terminal_%28application%29">Terminal</a> window.<br /></li><li>To change to your build directory, type: <br /><br /><pre>cd ~/Build<br /></pre><br /></li><br /><li>To check the <a href="http://en.wikipedia.org/wiki/MD5">MD5</a> checksum of the tarball, run one of the following commands:<br /><br /><br /><br /><pre>/sbin/md5 /absolute/path/to/alpine-x.xx.tar.bz2<br />/usr/bin/openssl md5 /absolute/path/to/alpine-x.xx.tar.bz2</pre><br />I recommend that you specify the absolute path to both the command and the tarball to ensure you are not specifying <a href="http://en.wikipedia.org/wiki/Trojan_horse_%28computing%29">trojans</a>. The MD5 checksum should match the MD5 checksum that is in the x.xx release <a href="http://mailman2.u.washington.edu/pipermail/alpine-announce/">announcement</a> message.</li><br /><li>To list the table of contents of the tarball, type: <br /><br /><br /><br /><pre><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/tar.1.html">tar</a> jtvf alpine-x.xx.tar.bz2 | less</pre><br />Note:<br /><br /><br /><pre>j = bunzip2<br />t = table of contents<br />v = verbose<br />f = file</pre><br /></li><br /><li>To un<a href="http://en.wikipedia.org/wiki/Bzip2">bzip2</a> (bunzip2) and untar the tarball, type: <br /><br /><br /><pre><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/tar.1.html">tar</a> jxvf alpine-x.xx.tar.bz2<br /></pre><br />Note:<br /><br /><br /><pre>j = bunzip2<br />x = extract<br />v = verbose<br />f = file</pre><br /></li><br /><li>To change to the newly created alpine-x.xx directory, type: <br /><br /><br /><pre>cd alpine-x.xx<br /></pre><br /></li><br /><li>To read the README and the configuration help, type: <br /><br /><br /><pre><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/less.1.html">less</a> README<br />./configure --help |less<br /></pre><br /></li><br /><li>To build Alpine, type the following (which are discussed in the README): <br /><br /><br /><pre>./configure<br />make<br /></pre><br /></li><br /><li>After the build is finished, type: <br /><br /><br /><pre><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/sudo.8.html">sudo</a> make install<br /></pre><br />You will be prompted for your Mac OS X password. <b><i>Note</i></b> that you need to be using an OS X admin account to use sudo and that this command will replace any Alpine files that are in <code>/usr/local/bin</code>.</li><br /><li>To check that Alpine was built and installed correctly, type: <br /><br /><br /><pre>man alpine<br />alpine<br /></pre>Make sure that these two commands invoke the correct version (x.xx). If these commands do not work, you probably need to add /usr/local/man to your <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/manpath.1.html">MANPATH</a> <a href="http://en.wikipedia.org/wiki/Environment_variable">environment variable</a> and /usr/local/bin to your PATH environment variable. For details, see the man page for your shell (<a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/bash.1.html">man bash</a>, <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/tcsh.1.html">man tcsh</a>, etc.). To determine your shell, run <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/finger.1.html"><kbd>finger -l</kbd></a>.</li></ol>To learn more about Alpine, which is basically Pine 5.0+, see: <br /><ul><li><kbd><a href="http://www.washington.edu/alpine/mans.html">man alpine</a></kbd></li><li><kbd>alpine -h | less</kbd></li><li>Alpine Release Notes, which can be viewed either <a href="http://www.washington.edu/alpine/changes.html">here</a> or by typing <span style="font-weight: bold;">MR</span> (Main > RelNotes) in Alpine</li><li>Alpine's built-in context-sensitive Help, which can be viewed by typing either <span style="font-weight: bold;">^G</span> (Get Help) or <span style="font-weight: bold;">?</span> in Alpine<br /></li><li><a href="http://mailman1.u.washington.edu/mailman/listinfo/alpine-alpha">Alpine-alpha list archives</a><br /></li><li><a href="http://www.ii.com/internet/messaging/pine/">All About Pine: POP, IMAP, NNTP, & ESMPT Client for Unix, MS Windows, and Mac OS X</a><br /></li><li><a href="http://www.ii.com/internet/messaging/pine/pc/">Power Pine: Getting the Most Out of Unix-, Mac-, and PC-Pine</a></li></ul>Good luck with Alpine and I hope to see you in the Alpine-alpha list!<br /><br /><b><i>Tip 1:</i></b> You should be able to use a modified version of these instructions to build Alpine on any <a href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> system. For example, I used Steps 3-12 to build Alpine on my <a href="http://www.dreamhost.com/r.cgi?iidotcom/shared/comparison.html">DreamHost shared hosting account</a>, which runs <a href="http://www.debian.org/">Debian Linux</a>.<br /><br /><i><b>Tip 2:</b></i> The Alpine FTP site includes pre-built versions of Alpine for MS Windows (PC-Alpine): alpine-x.xx-wnt.zip and setup_alpine_x.xx.exe. Details are in <a href="ftp://ftp.cac.washington.edu">ftp://ftp.cac.washington.edu</a>/<a href="ftp://ftp.cac.washington.edu/alpine">alpine</a>/<a href="ftp://ftp.cac.washington.edu/alpine/README">README</a><br /><br /><i><b>See Also:</b></i> <br /><ul><li>Paul Heinlein's madboa.com: <a href="http://www.madboa.com/geek/pine-macosx/">Pine and Alpine on Mac OS X</a>, which includes notes on building and running Pine or Alpine under Mac OS X.</li><li>University of Washington: <a href="http://www.washington.edu/alpine/tech-notes/">Alpine Technical Notes</a>: <a href="http://www.washington.edu/alpine/tech-notes/installation.html">Building and Installation</a></li></ul>NMnoreply@blogger.com