<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>0t@k-B@L! &#187; .htaccess</title>
	<atom:link href="http://www.otakbali.com/category/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otakbali.com</link>
	<description>think about web programming</description>
	<lastBuildDate>Mon, 02 Aug 2010 03:56:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>.htaccess Tricks: #2 – Essentials</title>
		<link>http://www.otakbali.com/htaccess-tricks-2-essentials.html</link>
		<comments>http://www.otakbali.com/htaccess-tricks-2-essentials.html#comments</comments>
		<pubDate>Fri, 30 Oct 2009 17:32:08 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=52</guid>
		<description><![CDATA[Commenting your htaccess Files It is an excellent idea to consistenly and logically comment your htaccess files. Any line in an htaccess file that begins with the pound sign ( # ) tells the server to ignore it. Multiple lines require multiple pounds and use letters/numbers/dash/underscore only: # this is a comment # each line [...]]]></description>
			<content:encoded><![CDATA[<p><strong id="ess1">Commenting your htaccess Files</strong> <a name="top"></a></p>
<p>It is an excellent idea to consistenly and logically comment your htaccess files. Any line in an htaccess file that begins with the pound sign ( # ) tells the server to ignore it. Multiple lines require multiple pounds and use letters/numbers/dash/underscore only:</p>
<p><code># this is a comment</code><br />
<code># each line must have its own pound sign</code><br />
<code># use only alphanumeric characters along with dashes - and underscores _</code></p>
<p><span id="more-52"></span></p>
<p><strong id="ess2">Enable Basic Rewriting</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>Certain servers may not have “<code>mod_rewrite</code>” enabled by default. To ensure <code>mod_rewrite</code> (basic rewriting) is enabled throughout your site, add the following line once to your site’s root htaccess file:</p>
<p><code># enable basic rewriting</code><br />
<code>RewriteEngine on</code></p>
<p><strong id="ess3">Enable Symbolic Links</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>Enable symbolic links (symlinks) by adding the following directive to the target directory’s htaccess file. Note: for the <code>FollowSymLinks</code> directive to function, <code>AllowOverride Options</code> privileges must be enabled from within the server configuration file :</p>
<p><code># enable symbolic links</code><br />
<code>Options +FollowSymLinks</code></p>
<p><strong id="ess4">Enable AllowOverride</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>For directives that require <code>AllowOverride</code> in order to function, such as <code>FollowSymLinks</code> (see above paragraph), the following directive must be added to the server configuration file. For performance considerations, it is important to only enable <code>AllowOverride</code> in the specific directory or directories in which it is required. In the following code chunk, we are enabling the <code>AllowOverride</code> privs only in the specified directory (/www/replace/this/with/actual/directory). Refer to this code for <code>AllowOverride</code> sample:</p>
<p><code># enable allowoverride privileges</code><br />
<code>&lt;Directory /www/replace/this/with/actual/directory&gt;</code><br />
<code>AllowOverride Options</code><br />
<code>&lt;/Directory&gt;</code></p>
<p><strong id="ess5">Rename the htaccess File</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>Not every system enjoys the extension-only format of htaccess files. Fortunately, you can rename them to whatever you wish, granted the name is valid on your system. Note: This directive must be placed in the server-wide configuration file or it will not work:</p>
<p><code># rename htaccess files</code><br />
<code>AccessFileName ht.access</code></p>
<p>Note: If you rename your htaccess files, remember to update any associated configuration settings. For example, if you are protecting your htaccess file via <code>FilesMatch</code>, remember to inform it of the renamed files:</p>
<p><code># protect renamed htaccess files</code><br />
<code>&lt;FilesMatch "^ht\."&gt;</code><br />
<code>Order deny,allow</code><br />
<code>Deny from all</code><br />
<code>&lt;/FilesMatch&gt;</code></p>
<p><strong id="ess6">Retain Rules Defined in httpd.conf</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>Save yourself time and effort by defining replicate rules for multiple virtual hosts once and only once via your httpd.conf file. Then, simply instruct your target htaccess file(s) to inheret the httpd.conf rules by including this directive:</p>
<p><code>RewriteOptions Inherit</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/htaccess-tricks-2-essentials.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.htaccess Tricks: #1 &#8211; Definition</title>
		<link>http://www.otakbali.com/htaccess-tricks-1-definition.html</link>
		<comments>http://www.otakbali.com/htaccess-tricks-1-definition.html#comments</comments>
		<pubDate>Wed, 28 Oct 2009 15:29:26 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=48</guid>
		<description><![CDATA[.htaccess definition: Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. These .htaccess files enable the localized fine-tuning of Apache’s universal system-configuration directives, which are defined in Apache’s main configuration file. The localized .htaccess directives must operate from within a file named .htaccess. The user must have appropriate file permissions to access [...]]]></description>
			<content:encoded><![CDATA[<p><a name="top"></a></p>
<div class="wp-caption alignleft" style="width: 190px"><a href="http://otakbali.com/tag/htaccess"><img class=" " title=".htaccess in otakbali" src="http://i720.photobucket.com/albums/ww207/andiim3/otakbali_htaccess.gif" alt=".htaccess Tips n Trick" width="180" height="180" /></a><p class="wp-caption-text">.htaccess Tips n Trick</p></div>
<p style="text-align: justify;"><strong><code>.htaccess</code> definition: </strong><br />
Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. These <a title="htaccess at Wikipedia" rel="nofollow" href="http://en.wikipedia.org/wiki/Htaccess"><code>.</code><code>htaccess</code></a> files enable the localized fine-tuning of Apache’s universal system-configuration directives, which are defined in Apache’s main configuration file. The localized <code>.</code><code>htaccess</code> directives must operate from within a file named <code>.</code><code>htaccess</code>. The user must have appropriate file permissions to access and/or edit the <code>.</code><code>htaccess</code> file. Further, <code>.</code><code>htaccess</code> file permissions should never allow world write access — a secure permissions setting is “644”, which allows universal read access and user-only write access. Finally, <code>.</code><code>htaccess</code> rules apply to the parent directory and all subdirectories. Thus to apply configuration rules to an entire website, place the <code>.</code><code>htaccess</code> file in the root directory of the site.<br />
<span id="more-48"></span></p>
<p style="text-align: justify;"><strong>Comments on <code>.htaccess</code> code</strong><br />
Comments are essential to maintaining control over any involved portion of code. Comments in <code>.</code><code>htaccess</code> code are fashioned on a per-line basis, with each line of comments beginning with a pound sign <code>#</code>. Thus, comments spanning multiple lines in the <code>.</code><code>htaccess</code> file require multiple pound signs. Further, due to the extremely volatile nature of htaccess voodoo, it is wise to include only alphanumeric characters (and perhaps a few dashes and underscores) in any <code>.</code><code>htaccess</code> comments.</p>
<p><strong id="gen3">Important Notes for .</strong><strong>htaccess Noobs</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p>As a configuration file, <code>.</code><code>htaccess</code> is very powerful. Even the slightest syntax error (like a missing space) can result in severe server malfunction. Thus it is crucial to make backup copies of <em>everything</em> related to your site (including any original <code>.</code><code>htaccess</code> files) <em>before</em> working with your Hypertext Access file(s). It is also important to check your entire website thoroughly after making any changes to your <code>.</code><code>htaccess</code> file. If any errors or other problems are encountered, employ your backups immediately to restore original functionality.</p>
<p><strong id="gen4">Performance Issues</strong> <small>[ <a href="#top">^</a> ]</small></p>
<p><code>.</code><code>htaccess</code> directives provide directory-level configuration without requiring access to Apache’s main server cofiguration file (httpd.conf). However, due to performance and security concerns, the main configuration file should always be used for server directives whenever possible. For example, when a server is configured to process <code>.</code><code>htaccess</code> directives, Apache must search every directory within the domain and load any and all <code>.</code><code>htaccess</code> files upon every document request. This results in increased page processing time and thus decreases performance. Such a performance hit may be unnoticeable for sites with light traffic, but becomes a more serious issue for more popular websites. Therefore, <code>.</code><code>htaccess</code> files should only be used when the main server configuration file is inaccessible. See the “<a href="\#performance">Performance Tricks</a>” section of this article for more information.</p>
<p><strong id="gen5">Regex Character Definitions for htaccess</strong><sup>2</sup> <small>[ <a href="#top">^</a> ]</small></p>
<dl>
<dt><code>#</code></dt>
<dd>the <code>#</code> instructs the server to ignore the line. used for including comments. each line of comments requires it’s own <code>#</code>. when including comments, it is good practice to use only letters, numbers, dashes, and underscores. this practice will help eliminate/avoid potential server parsing errors.</dd>
<dt><code>[F]</code></dt>
<dd>Forbidden: instructs the server to return a <code>403 Forbidden</code> to the client.</dd>
<dt><code>[L]</code></dt>
<dd>Last rule: instructs the server to stop rewriting after the preceding directive is processed.</dd>
<dt><code>[N]</code></dt>
<dd>Next: instructs Apache to rerun the rewrite rule until all rewriting directives have been achieved.</dd>
<dt><code>[G]</code></dt>
<dd>Gone: instructs the server to deliver <code>Gone (no longer exists)</code> status message.</dd>
<dt><code>[P]</code></dt>
<dd>Proxy: instructs server to handle requests by <code>mod_proxy</code></dd>
<dt><code>[C]</code></dt>
<dd>Chain: instructs server to chain the current rule with the previous rule.</dd>
<dt><code>[R]</code></dt>
<dd>Redirect: instructs Apache to issue a redirect, causing the browser to request the rewritten/modified URL.</dd>
<dt><code>[NC]</code></dt>
<dd>No Case: defines any associated argument as case-<em>in</em>sensitive. i.e., &#8220;NC&#8221; = &#8220;No Case&#8221;.</dd>
<dt><code>[PT]</code></dt>
<dd>Pass Through: instructs <code>mod_rewrite</code> to pass the rewritten URL back to Apache for further processing.</dd>
<dt><code>[OR]</code></dt>
<dd>Or: specifies a logical &#8220;or&#8221; that ties two expressions together such that either one proving true will cause the associated rule to be applied.</dd>
<dt><code>[NE]</code></dt>
<dd>No Escape: instructs the server to parse output without escaping characters.</dd>
<dt><code>[NS]</code></dt>
<dd>No Subrequest: instructs the server to skip the directive if internal sub-request.</dd>
<dt><code>[QSA]</code></dt>
<dd>Append Query String: directs server to add the query string to the end of the expression (URL).</dd>
<dt><code>[S=x]</code></dt>
<dd>Skip: instructs the server to skip the next &#8220;x&#8221; number of rules if a match is detected.</dd>
<dt><code>[E=variable:value]</code></dt>
<dd>Environmental Variable: instructs the server to set the environmental variable &#8220;variable&#8221; to &#8220;value&#8221;.</dd>
<dt><code>[T=MIME-type]</code></dt>
<dd>Mime Type: declares the mime type of the target resource.</dd>
<dt><code>[]</code></dt>
<dd>specifies a character class, in which any character within the brackets will be a match. e.g., [xyz] will match either an x, y, or z.</dd>
<dt><code>[]+</code></dt>
<dd>character class in which any combination of items within the brackets will be a match. e.g., [xyz]+ will match any number of x’s, y’s, z’s, or any combination of these characters.</dd>
<dt><code>[^]</code></dt>
<dd>specifies <em>not</em> within a character class. e.g., [^xyz] will match any character that is neither x, y, nor z.</dd>
<dt><code>[a-z]</code></dt>
<dd>a dash (-) between two characters within a character class ([]) denotes the range of characters between them. e.g., [a-zA-Z] matches all lowercase and uppercase letters from a to z.</dd>
<dt><code>a{n}</code></dt>
<dd>specifies an exact number, <code>n</code>, of the preceding character. e.g., x{3} matches exactly three <code>x</code>’s.</dd>
<dt><code>a{n,}</code></dt>
<dd>specifies <code>n</code> or more of the preceding character. e.g., x{3,} matches three or more <code>x</code>’s.</dd>
<dt><code>a{n,m}</code></dt>
<dd>specifies a range of numbers, between <code>n</code> and <code>m</code>, of the preceding character. e.g., x{3,7} matches three, four, five, six, or seven <code>x</code>’s.</dd>
<dt><code>()</code></dt>
<dd>used to group characters together, thereby considering them as a single unit. e.g., (perishable)?press will match press, with or without the perishable prefix.</dd>
<dt><code>^</code></dt>
<dd>denotes the beginning of a regex (regex = regular expression) test string. i.e., begin argument with the proceeding character.</dd>
<dt><code>$</code></dt>
<dd>denotes the end of a regex (regex = regular expression) test string. i.e., end argument with the previous character.</dd>
<dt><code>?</code></dt>
<dd>declares as optional the preceding character. e.g., <code>monzas?</code> will match monza or monzas, while <code>mon(za)?</code> will match either mon or monza. i.e., <code>x?</code> matches zero or one of <code>x</code>.</dd>
<dt><code>!</code></dt>
<dd>declares negation. e.g., “<code>!string</code>” matches everything except “<code>string</code>”.</dd>
<dt><code>.</code></dt>
<dd>a dot (or period) indicates any single arbitrary character.</dd>
<dt><code>-</code></dt>
<dd>instructs “not to” rewrite the URL, as in “<code>...domain.com.* - [F]</code>”.</dd>
<dt><code>+</code></dt>
<dd>matches one or more of the preceding character. e.g., <code>G+</code> matches one or more G’s, while &#8220;+&#8221; will match one or more characters of any kind.</dd>
<dt><code>*</code></dt>
<dd>matches zero or more of the preceding character. e.g., use “<code>.*</code>” as a wildcard.</dd>
<dt><code>|</code></dt>
<dd>declares a logical “or” operator. for example, <code>(x|y)</code> matches <code>x</code> or <code>y</code>.</dd>
<dt><code>\</code></dt>
<dd>escapes special characters ( <code>^ $ ! . * |</code> ). e.g., use “<code>\.</code>” to indicate/escape a literal dot.</dd>
<dt><code>\.</code></dt>
<dd>indicates a literal dot (escaped).</dd>
<dt><code>/*</code></dt>
<dd>zero or more slashes.</dd>
<dt><code>.*</code></dt>
<dd>zero or more arbitrary characters.</dd>
<dt><code>^$</code></dt>
<dd>defines an empty string.</dd>
<dt><code>^.*$</code></dt>
<dd>the standard pattern for matching everything.</dd>
<dt><code>[^/.]</code></dt>
<dd>defines one character that is neither a slash nor a dot.</dd>
<dt><code>[^/.]+</code></dt>
<dd>defines any number of characters which contains neither slash nor dot.</dd>
<dt><code>http://</code></dt>
<dd>this is a literal statement — in this case, the literal character string, “http://”.</dd>
<dt><code>^domain.*</code></dt>
<dd>defines a string that begins with the term “<code>domain</code>”, which then may be proceeded by any number of any characters.</dd>
<dt><code>^domain\.com$</code></dt>
<dd>defines the exact string “<code>domain.com</code>”.</dd>
<dt><code>-d</code></dt>
<dd>tests if string is an existing directory</dd>
<dt><code>-f</code></dt>
<dd>tests if string is an existing file</dd>
<dt><code>-s</code></dt>
<dd>tests if file in test string has a non-zero value</dd>
</dl>
<p><strong id="gen6">Redirection Header Codes</strong> <small>[ <a href="#top">^</a> ]</small></p>
<ul>
<li>301 &#8211; Moved Permanently</li>
<li>302 &#8211; Moved Temporarily</li>
<li>403 &#8211; Forbidden</li>
<li>404 &#8211; Not Found</li>
<li>410 &#8211; Gone</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/htaccess-tricks-1-definition.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
