<?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>AskApache &#187; Search Results  &#187;  nsa</title>
	<atom:link href="http://www.askapache.com/search/nsa/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Thu, 26 Apr 2012 11:29:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Raw HTTP Header Debugger</title>
		<link>http://www.askapache.com/online-tools/http-headers-tool</link>
		<comments>http://www.askapache.com/online-tools/http-headers-tool#comments</comments>
		<pubDate>Wed, 26 Oct 2011 15:14:08 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
		
		<guid isPermaLink="false">http://www.askapache.com/online-tools/http-headers-tool/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/online-tools/http-headers-tool"></a><a href="http://www.askapache.com/online-tools/http-headers-tool"><cite>AskApache.com</cite></a></p><hr class="C" />
<h2>HTTP Headers</h2>
<table>
    <thead>
        <tr>
            <td><strong>HTTP Header Name</strong></td>
            <td><strong>Header Description</strong></td>
            <td><strong>Example HTTP Header</strong></td>
        </tr>
    </thead>
    <tr>
        <td>Accept</td>
        <td>Content-Types that are acceptable</td>
        <td><code>Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</code></td>
    </tr>
    <tr>
        <td>Accept-Charset</td>
        <td>Character sets that are acceptable</td>
        <td><code>Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7</code></td>
    </tr>
    <tr>
        <td>Accept-Encoding</td>
        <td>Acceptable encodings</td>
        <td><code>Accept-Encoding: gzip,deflate</code></td>
    </tr>
    <tr>
        <td>Accept-Language</td>
        <td>Acceptable languages for response</td>
        <td><code>Accept-Language: en-us,en</code></td>
    </tr>
    <tr>
        <td>Accept-Ranges</td>
        <td>What partial content range types this server supports</td>
        <td><code>Accept-Ranges: bytes</code></td>
    </tr>
    <tr>
        <td>Age</td>
        <td>The age the object has been in a proxy cache in seconds</td>
        <td><code>Age: 7200</code></td>
    </tr>
    <tr>
        <td>Allow</td>
        <td>Valid actions for a specified resource. To be used for a 405 Method not allowed</td>
        <td><code>Allow: GET,HEAD,POST,OPTIONS,TRACE</code></td>
    </tr>
    <tr>
        <td>Authorization</td>
        <td>Authentication credentials for HTTP authentication</td>
        <td><code>Authorization: Basic UXNrYXBhggRfoopc5NteWFzcw==</code></td>
    </tr>
    <tr>
        <td>Cache-Control</td>
        <td>Controls how proxies may cache this object</td>
        <td><code>Cache-Control: max-age=7200, public</code></td>
    </tr>
    <tr>
        <td>Connection</td>
        <td>What type of connection the user-agent would prefer</td>
        <td><code>Connection: Keep-Alive</code></td>
    </tr>
    <tr>
        <td>Content-Encoding</td>
        <td>The type of encoding used on the data</td>
        <td><code>Content-Encoding: gzip</code></td>
    </tr>
    <tr>
        <td>Content-Language</td>
        <td>The language the content is in</td>
        <td><code>Content-Language: en-us</code></td>
    </tr>
    <tr>
        <td>Content-Length</td>
        <td>The length of the content in bytes</td>
        <td><code>Content-Length: 5356</code></td>
    </tr>
    <tr>
        <td>Content-Location</td>
        <td>An alternate location for the returned data</td>
        <td><code>Content-Location: /index.html</code></td>
    </tr>
    <tr>
        <td>Content-MD5</td>
        <td>An MD5 sum of the content of the response</td>
        <td><code>Content-MD5: 1167b9c13ad2b6d3694493fc47976c8</code></td>
    </tr>
    <tr>
        <td>Content-Range</td>
        <td>Where in a full body message this partial message belongs</td>
        <td><code>Content-Range: bytes 110-2034/2035</code></td>
    </tr>
    <tr>
        <td>Content-Type</td>
        <td>The mime type of this content</td>
        <td><code>Content-Type: text/html; charset=UTF-8</code></td>
    </tr>
    <tr>
        <td>Date</td>
        <td>The date and time that the message was sent</td>
        <td><code>Date: Sat, 05 Jan 2008 09:27:35 GMT</code></td>
    </tr>
    <tr>
        <td>Host</td>
        <td>The domain name of the server (for virtual hosting)</td>
        <td><code>Host: www.askapache.com</code></td>
    </tr>
    <tr>
        <td>If-Modified-Since</td>
        <td>Allows a 304 Not Modified to be returned</td>
        <td><code>If-Modified-Since: Sat, 05 Jan 2007 09:26:12 GMT</code></td>
    </tr>
    <tr>
        <td>Last-Modified</td>
        <td>The last modified date for the requested object</td>
        <td><code>Last-Modified: Sat, 05 Jan 2008 09:26:12 GMT</code></td>
    </tr>
    <tr>
        <td>Location</td>
        <td>Used in redirection</td>
        <td><code>Location: http://www.askapache.com/</code></td>
    </tr>
    <tr>
        <td>Server</td>
        <td>A name for the server</td>
        <td><code>Server: Apache/2.0.61 (Unix) PHP/4.4.7 mod_ssl/2.0.61 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2</code></td>
    </tr>
    <tr>
        <td>User-Agent</td>
        <td>The user agent string of the user agent</td>
        <td><code>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7</code></td>
    </tr>
</table>
<hr class="C" />


<address>part of <a rev='Section' href='http://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a><br />RFC 2616 Fielding, et al.</address>
<h2><a id='sec9'>9</a> Method Definitions</h2>
<p>The set of common methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumed to share the same semantics for separately extended clients and servers.</p>
<p>The Host request-header field (section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23'>14.23</a>) MUST accompany all HTTP/1.1 requests.</p>
<h3><a id='sec9.1'>9.1</a> Safe and Idempotent Methods</h3>
<h3><a id='sec9.1.1'>9.1.1</a> Safe Methods</h3>
<p>Implementors should be aware that the software represents the user in their interactions over the Internet, and should be careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves or others.</p>
<p>In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.</p>
<p>Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.</p>
<h3><a id='sec9.1.2'>9.1.2</a> Idempotent Methods</h3>
<p>Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property. Also, the methods OPTIONS and TRACE SHOULD NOT have side effects, and so are inherently idempotent.</p>
<p>However, it is possible that a sequence of several requests is non- idempotent, even if all of the methods executed in that sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always yields a result that is not changed by a reexecution of all, or part, of that sequence.) For example, a sequence is non-idempotent if its result depends on a value that is later modified in the same sequence.</p>
<p>A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are being executed on the same set of resources).</p>
<h3><a id='sec9.2'>9.2</a> OPTIONS</h3>
<p>The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.</p>
<p>Responses to this method are not cacheable.</p>
<p>If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then the media type MUST be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension MAY discard the request body.</p>
<p>If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).</p>
<p>If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource.</p>
<p>A 200 response SHOULD include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The response body, if any, SHOULD also include information about the communication options. The format for such a</p>
<p>body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be used to select the appropriate response format. If no response body is included, the response MUST include a Content-Length field with a field-value of "0".</p>
<p>The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy MUST NOT forward the message; instead, the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded request MUST NOT include a Max-Forwards field.</p>
<h3><a id='sec9.3'>9.3</a> GET</h3>
<p>The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.</p>
<p>The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client.</p>
<p>The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the entity be transferred, as described in section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35'>14.35</a>. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client.</p>
<p>The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching described in section 13.</p>
<p>See section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html#sec15.1.3'>15.1.3</a> for security considerations when used for forms.</p>
<h3><a id='sec9.4'>9.4</a> HEAD</h3>
<p>The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.</p>
<p>The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat the cache entry as stale.</p>
<h3><a id='sec9.5'>9.5</a> POST</h3>
<p>The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:</p>
<pre>      - Annotation of existing resources; </pre>
<pre>      - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; </pre>
<pre>      - Providing a block of data, such as the result of submitting a form, to a data-handling process; </pre>
<pre>      - Extending a database through an append operation. </pre>
<p>The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database.</p>
<p>The action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result.</p>
<p>If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30'>14.30</a>).</p>
<p>Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource.</p>
<p>POST requests MUST obey the message transmission requirements set out in section 8.2.</p>
<p>See section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec15.html#sec15.1.3'>15.1.3</a> for security considerations.</p>
<h3><a id='sec9.6'>9.6</a> PUT</h3>
<p>The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.</p>
<p>If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.</p>
<p>The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI,</p>
<p>it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.</p>
<p>A single resource MAY be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in several other URIs being defined by the origin server.</p>
<p>HTTP/1.1 does not define how a PUT method affects the state of an origin server.</p>
<p>PUT requests MUST obey the message transmission requirements set out in section 8.2.</p>
<p>Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request SHOULD be applied to the resource created or modified by the PUT.</p>
<h3><a id='sec9.7'>9.7</a> DELETE</h3>
<p>The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.</p>
<p>A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.</p>
<p>If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.</p>
<h3><a id='sec9.8'>9.8</a> TRACE</h3>
<p>The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the</p>
<p>origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity.</p>
<p>TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field (section <a rel='xref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.45'>14.45</a>) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.</p>
<p>If the request is valid, the response SHOULD contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method MUST NOT be cached.</p>
<h3><a id='sec9.9'>9.9</a> CONNECT</h3>
<p>This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel (e.g. SSL tunneling <a rel='bibref' href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec17.html#bib44'>[44]</a>).</p>


<h2><a href="http://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html">List of HTTP Response Status Codes</a></h2>
<h3>1xx Info / Informational</h3>
<h4><code>HTTP_INFO</code> - Request received, continuing process.</h4>
<p>Indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.</p>
<ul>
    <li><strong>100 Continue</strong> - <code>HTTP_CONTINUE</code></li>
    <li><strong>101 Switching Protocols</strong> - <code>HTTP_SWITCHING_PROTOCOLS</code></li>
    <li><strong>102 Processing</strong> - <code>HTTP_PROCESSING</code></li>
</ul>
<h3>2xx Success / OK</h3>
<h4><code>HTTP_SUCCESS</code> - The action was successfully received, understood, and accepted.</h4>
<p>Indicates that the client's request was successfully received, understood, and accepted.</p>
<ul>
    <li><strong>200 OK</strong> - <code>HTTP_OK</code></li>
    <li><strong>201 Created</strong> - <code>HTTP_CREATED</code></li>
    <li><strong>202 Accepted</strong> - <code>HTTP_ACCEPTED</code></li>
    <li><strong>203 Non-Authoritative Information</strong> - <code>HTTP_NON_AUTHORITATIVE</code></li>
    <li><strong>204 No Content</strong> - <code>HTTP_NO_CONTENT</code></li>
    <li><strong>205 Reset Content</strong> - <code>HTTP_RESET_CONTENT</code></li>
    <li><strong>206 Partial Content</strong> - <code>HTTP_PARTIAL_CONTENT</code></li>
    <li><strong>207 Multi-Status</strong> - <code>HTTP_MULTI_STATUS</code></li>
</ul>
<h3>3xx Redirect</h3>
<h4><code>HTTP_REDIRECT</code> - The client must take additional action to complete the request.</h4>
<p>Indicates that further action needs to be taken by the user-agent in order to fulfill the request. The action required may be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. A user agent should not automatically <em>redirect a request more than 5 times</em>, since such redirections usually indicate an <strong>infinite loop</strong>.</p>
<ul>
    <li><strong>300 Multiple Choices</strong> - <code>HTTP_MULTIPLE_CHOICES</code></li>
    <li><strong>301 Moved Permanently</strong> - <code>HTTP_MOVED_PERMANENTLY</code></li>
    <li><strong>302 Found</strong> - <code>HTTP_MOVED_TEMPORARILY</code></li>
    <li><strong>303 See Other</strong> - <code>HTTP_SEE_OTHER</code></li>
    <li><strong>304 Not Modified</strong> - <code>HTTP_NOT_MODIFIED</code></li>
    <li><strong>305 Use Proxy</strong> - <code>HTTP_USE_PROXY</code></li>
    <li><strong>306 unused</strong> - <code>UNUSED</code></li>
    <li><strong>307 Temporary Redirect</strong> - <code>HTTP_TEMPORARY_REDIRECT</code></li>
</ul>
<h3>4xx Client Error</h3>
<h4><code>HTTP_CLIENT_ERROR</code> - The request contains bad syntax or cannot be fulfilled.</h4>
<p>Indicates case where client seems to have erred. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition.</p>
<ul>
    <li><strong>400 Bad Request</strong> - <code>HTTP_BAD_REQUEST</code></li>
    <li><strong>401 Authorization Required</strong> - <code>HTTP_UNAUTHORIZED</code></li>
    <li><strong>402 Payment Required</strong> - <code>HTTP_PAYMENT_REQUIRED</code></li>
    <li><strong>403 Forbidden</strong> - <code>HTTP_FORBIDDEN</code></li>
    <li><strong>404 Not Found</strong> - <code>HTTP_NOT_FOUND</code></li>
    <li><strong>405 Method Not Allowed</strong> - <code>HTTP_METHOD_NOT_ALLOWED</code></li>
    <li><strong>406 Not Acceptable</strong> - <code>HTTP_NOT_ACCEPTABLE</code></li>
    <li><strong>407 Proxy Authentication Required</strong> - <code>HTTP_PROXY_AUTHENTICATION_REQUIRED</code></li>
    <li><strong>408 Request Time-out</strong> - <code>HTTP_REQUEST_TIME_OUT</code></li>
    <li><strong>409 Conflict</strong> - <code>HTTP_CONFLICT</code></li>
    <li><strong>410 Gone</strong> - <code>HTTP_GONE</code></li>
    <li><strong>411 Length Required</strong> - <code>HTTP_LENGTH_REQUIRED</code></li>
    <li><strong>412 Precondition Failed</strong> - <code>HTTP_PRECONDITION_FAILED</code></li>
    <li><strong>413 Request Entity Too Large</strong> - <code>HTTP_REQUEST_ENTITY_TOO_LARGE</code></li>
    <li><strong>414 Request-URI Too Large</strong> - <code>HTTP_REQUEST_URI_TOO_LARGE</code></li>
    <li><strong>415 Unsupported Media Type</strong> - <code>HTTP_UNSUPPORTED_MEDIA_TYPE</code></li>
    <li><strong>416 Requested Range Not Satisfiable</strong> - <code>HTTP_RANGE_NOT_SATISFIABLE</code></li>
    <li><strong>417 Expectation Failed</strong> - <code>HTTP_EXPECTATION_FAILED</code></li>
    <li><strong>418 unused</strong> - <code>UNUSED</code></li>
    <li><strong>419 unused</strong> - <code>UNUSED</code></li>
    <li><strong>420 unused</strong> - <code>UNUSED</code></li>
    <li><strong>421 unused</strong> - <code>UNUSED</code></li>
    <li><strong>422 Unprocessable Entity</strong> - <code>HTTP_UNPROCESSABLE_ENTITY</code></li>
    <li><strong>423 Locked</strong> - <code>HTTP_LOCKED</code></li>
    <li><strong>424 Failed Dependency</strong> - <code>HTTP_FAILED_DEPENDENCY</code></li>
    <li><strong>425 No code</strong> - <code>HTTP_NO_CODE</code></li>
    <li><strong>426 Upgrade Required</strong> - <code>HTTP_UPGRADE_REQUIRED</code></li>
</ul>
<h3>5xx Server Error</h3>
<h4><code>HTTP_SERVER_ERROR</code> - The server failed to fulfill an apparently valid request.</h4>
<p>Indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server should include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents should display any included entity to the user. These response codes are applicable to any request method.</p>
<ul>
    <li><strong>500 Internal Server Error</strong> - <code>HTTP_INTERNAL_SERVER_ERROR</code></li>
    <li><strong>501 Method Not Implemented</strong> - <code>HTTP_NOT_IMPLEMENTED</code></li>
    <li><strong>502 Bad Gateway</strong> - <code>HTTP_BAD_GATEWAY</code></li>
    <li><strong>503 Service Temporarily Unavailable</strong> - <code>HTTP_SERVICE_UNAVAILABLE</code></li>
    <li><strong>504 Gateway Time-out</strong> - <code>HTTP_GATEWAY_TIME_OUT</code></li>
    <li><strong>505 HTTP Version Not Supported</strong> - <code>HTTP_VERSION_NOT_SUPPORTED</code></li>
    <li><strong>506 Variant Also Negotiates</strong> - <code>HTTP_VARIANT_ALSO_VARIES</code></li>
    <li><strong>507 Insufficient Storage</strong> - <code>HTTP_INSUFFICIENT_STORAGE</code></li>
    <li><strong>508 unused</strong> - <code>UNUSED</code></li>
    <li><strong>509 unused</strong> - <code>UNUSED</code></li>
    <li><strong>510 Not Extended</strong> - <code>HTTP_NOT_EXTENDED</code></li>
</ul>
<h2>Helpful HTTP Links</h2>
<ol>
    <li><a href="http://rfc.askapache.com/rfc2616.html#section-10">HTTP specification, Section 10</a></li>
    <li><a href="http://rfc.askapache.com/rfc2817.html#section-4">TLS Upgrade within HTTP specification, Section 4</a></li>
    <li><a href="http://rfc.askapache.com/rfc2817.html#section-7.1">HTTP Status Code Registry</a></li>
    <li><a href="http://rfc.askapache.com/rfc4918.html#section-11">WebDAV specification, Section 11</a></li>
    <li><a href="http://www.iana.org/assignments/http-status-codes">IANA registry</a></li>
    <li><a href="http://livedocs.adobe.com/fms/2/docs/00000338.html">Adobe Flash status code definitions (ie 408)</a></li>
    <li><a href="http://support.microsoft.com/?id=318380">Microsoft Internet Information Server Status Codes and Sub-Codes</a></li>
    <li>httplint</li>
    <li><a href="http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html">HTTP Headers, brief intro.</a></li>
    <li><a href="http://www.w3.org/TR/cuap">Common User-Agent Issues</a></li>
</ol>
<hr class="C" />
<dl>
    <dt>DRP</dt>
    <dd><a href="http://www.w3.org/TR/NOTE-drp-19970825">"The HTTP Distribution and Replication Protocol"</a></dd>
    <dt>DupSup</dt>
    <dd><a href="http://www3.ietf.org/proceedings/98dec/I-D/draft-mogul-http-dupsup-00.txt">"Duplicate Suppression in HTTP"</a></dd>
    <dt>EARL Schema</dt>
    <dd><a href="http://www.w3.org/WAI/ER/EARL10/WD-EARL10-Schema-20060101">"Evaluation and Report Language (EARL) 1.0 Schema"</a></dd>
    <dt>EDD</dt>
    <dd><a href="http://wp.netscape.com/assist/net_sites/pushpull.html">"An exploration of dynamic documents"</a></dd>
    <dt>EdgeArch</dt>
    <dd><a href="http://www.w3.org/TR/2001/NOTE-edge-arch-20010804">"Edge Architecture Specification"</a></dd>
    <dt>HttpClient</dt>
    <dd><a href="http://jakarta.apache.org/commons/httpclient/">Jakarta Commons HttpClient</a></dd>
    <dt>HTML4</dt>
    <dd><a href="http://www.w3.org/TR/1999/REC-html401-19991224/">"HTML 4.01 Specification"</a></dd>
    <dt>JEPI</dt>
    <dd><a href="http://www.w3.org/TR/NOTE-jepi-970519">"White Paper: Joint Electronic Payment Initiative"</a></dd>
    <dt>ObjectHeaders</dt>
    <dd><a href="http://www.w3.org/Protocols/HTTP/Object_Headers.html">"Object Header lines in HTTP"</a></dd>
    <dt>OPS-OverHTTP</dt>
    <dd><a href="http://www.w3.org/TR/NOTE-OPS-OverHTTP">"Implementation of OPS Over HTTP"</a></dd>
    <dt>OPTIONS messages</dt>
    <dd>"Specification of HTTP/1.1 OPTIONS messages"</dd>
    <dt>P3P</dt>
    <dd><a href="http://www.w3.org/TR/2002/REC-P3P-20020416/">"The Platform for Privacy Preferences 1.0 (P3P1.0) Specification"</a></dd>
    <dt>PEP</dt>
    <dd><a href="http://www.w3.org/TR/WD-http-pep-970526">"PEP - an Extension Mechanism for HTTP"</a></dd>
    <dt>PICSLabels</dt>
    <dd><a href="http://www.w3.org/TR/REC-PICS-labels-961031">"PICS Label Distribution Label Syntax and Communication Protocols, Version 1.1"</a></dd>
    <dt>Proxy Notification</dt>
    <dd><a href="http://www.w3.org/TR/WD-proxy-960221">"Notification for Proxy Caches"</a></dd>
    <dt>RDF</dt>
    <dd><a href="http://www.w3.org/TR/rdf-concepts/">"Resource Description Framework (RDF): Concepts and Abstract Syntax"</a></dd>
    <dt>RDF-PRIMER</dt>
    <dd><a href="http://www.w3.org/TR/rdf-primer/"> <acronym title="Resource Description Framework">RDF</acronym> Primer</a></dd>
    <dt>RFC2068</dt>
    <dd><a href="http://rfc.askapache.com/rfc2068/">"Hypertext Transfer Protocol -- HTTP/1.1"</a></dd>
    <dt>RFC2109</dt>
    <dd><a href="http://rfc.askapache.com/rfc2109/">"HTTP State Management Mechanism"</a></dd>
    <dt>RFC2183</dt>
    <dd><a href="http://rfc.askapache.com/rfc2183/">"Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field"</a></dd>
    <dt>RFC2227</dt>
    <dd><a href="http://rfc.askapache.com/rfc2227/">"Simple Hit-Metering and Usage-Limiting for HTTP"</a></dd>
    <dt>RFC2295</dt>
    <dd><a href="http://rfc.askapache.com/rfc2295/">"Transparent Content Negotiation in HTTP"</a></dd>
    <dt>RFC2310</dt>
    <dd><a href="http://rfc.askapache.com/rfc2310/">"The Safe Response Header Field"</a></dd>
    <dt>RFC2324</dt>
    <dd><a href="http://rfc.askapache.com/rfc2324/">"Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)"</a></dd>
    <dt>RFC2397</dt>
    <dd><a href="http://rfc.askapache.com/rfc2397/">"The 'data' URL scheme"</a></dd>
    <dt>RFC2518</dt>
    <dd><a href="http://rfc.askapache.com/rfc2518/">"HTTP Extensions for Distributed Authoring -- WEBDAV"</a></dd>
    <dt>RFC2616</dt>
    <dd><a href="http://rfc.askapache.com/rfc2616/">"Hypertext Transfer Protocol -- HTTP/1.1"</a></dd>
    <dt>RFC2617</dt>
    <dd><a href="http://rfc.askapache.com/rfc2617/">"HTTP Authentication: Basic and Digest Access Authentication"</a></dd>
    <dt>RFC2660</dt>
    <dd><a href="http://rfc.askapache.com/rfc2660/">"The Secure HyperText Transfer Protocol"</a></dd>
    <dt>RFC2774</dt>
    <dd><a href="http://rfc.askapache.com/rfc2774/">"An HTTP Extension Framework"</a></dd>
    <dt>RFC2965</dt>
    <dd><a href="http://rfc.askapache.com/rfc2965/">"HTTP State Management Mechanism"</a></dd>
    <dt>RFC3229</dt>
    <dd><a href="http://rfc.askapache.com/rfc3229/">"Delta encoding in HTTP"</a></dd>
    <dt>RFC3230</dt>
    <dd><a href="http://rfc.askapache.com/rfc3230/">"Instance Digests in HTTP"</a></dd>
    <dt>RFC3253</dt>
    <dd><a href="http://rfc.askapache.com/rfc3253/">"Versioning Extensions to WebDAV (Web Distributed Authoring and Versioning)"</a></dd>
    <dt>RFC3648</dt>
    <dd><a href="http://rfc.askapache.com/rfc3648/">"Web Distributed Authoring and Versioning (WebDAV) Ordered Collections Protocol"</a></dd>
    <dt>RFC3986</dt>
    <dd><a href="http://rfc.askapache.com/rfc3648/">"Uniform Resource Identifier (URI): Generic Syntax"</a></dd>
    <dt>RFC4229</dt>
    <dd><a href="http://rfc.askapache.com/rfc4229/">"HTTP Header Field Registrations"</a></dd>
    <dt>SOAP1.1</dt>
    <dd><a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508">"Simple Object Access Protocol (SOAP) 1.1"</a></dd>
    <dt>UA Attributes</dt>
    <dd>"User-Agent Display Attributes Headers"</dd>
    <dt>WIRE</dt>
    <dd><a href="http://www3.ietf.org/proceedings/98dec/I-D/draft-girod-w3-id-res-ext-00.txt">"WIRE - W3 Identifier Resolution Extensions"</a></dd>
</dl><p><a href="http://www.askapache.com/online-tools/http-headers-tool"></a><a href="http://www.askapache.com/online-tools/http-headers-tool">Raw HTTP Header Debugger</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/online-tools/http-headers-tool/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Terminal Escape Code Zen</title>
		<link>http://www.askapache.com/linux/zen-terminal-escape-codes.html</link>
		<comments>http://www.askapache.com/linux/zen-terminal-escape-codes.html#comments</comments>
		<pubDate>Wed, 13 Apr 2011 04:00:27 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=4113</guid>
		<description><![CDATA[<p><strong>An image and technicacl achievement so profound, it will touch yoour heart</strong>..        So 3D... it'll hurt you eyes!  LOL..  lol.. Man I am cracking up here.  haha  Ha definately the best intro ever, those really do look 3D for terminal though huh.. Sweet.  Here is the little function I wrote to output that grey marble.</p>
<p><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"><img src="http://uploads.askapache.com/2011/04/3db.png" alt="AskApache Conquers the 3rd Dimension in Bash" title="AskApache Conquers the 3rd Dimension in Bash" width="795" height="481" class="alignnone size-full wp-image-4886" /></a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"></a><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"><cite>AskApache.com</cite></a></p><h3>Lightning Strikes Twice!</h3>
<p><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"><img src="http://uploads.askapache.com/2011/04/3da.png" alt="AskApache Conquers the 3rd Dimension in Bash" title="AskApache Conquers the 3rd Dimension in Bash" width="892" height="375" class="alignnone size-full wp-image-4885" /></a></p>
<p>LOL.. </p>
<h2>3rd Dimension Broken with Bash!</h2>
<p><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"><img src="http://uploads.askapache.com/2011/04/3db.png" alt="AskApache Conquers the 3rd Dimension in Bash" title="AskApache Conquers the 3rd Dimension in Bash" width="795" height="481" class="alignnone size-full wp-image-4886" /></a></p>
<p><strong>So 3D... it'll hurt you eyes!</strong>  lol.. Man I am cracking up here.   Ha but seriously those really do look 3D for terminal though..  I am actually really impressed.   Sweet.  Here is the little function I wrote to output that grey marble.</p>

<p class="cnote">Just a word to the wise, start learning and going over some of these concepts, especially the code used in functions, I will be back in a followup that details actually using this stu.


<p>This function is one of my favorites because it is so fast and useful.  Like when designing a 256color prompt.</p>
<pre>
aa_256 ()
{
    local o x=`tput op` y=`printf %$((${COLUMNS}-6))s`;
    for i in {0..256};
    do
        o=00$i;
        echo -e ${o:${#o}-3:3} `tputm "setaf $i" "setab $i"`${y// /=}$x;
    done
}</pre>



<p>Ya this is actually not very helpful or useful, but there you have it.</p>
<pre>tputm ()
{
    local a;
    for a in "$@";
    do
        echo -en "${a}\n";
    done | tput -S
}</pre>



<p>Some people call this function the grey bringer of death.  Not really.</p>
<pre>a256 ()
{
    ( x=`tput op` y=`printf %$((${COLUMNS}-6))slocal `;
    for i in {242..232} 232 232;
    do
        echo -en "`tput setaf $i;tput setab $i`${y}${x}`tput op`";
    done )
}</pre>



<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348099">Fix screen</a>











<h2>Helpful Ncurses Programs</h2>
<table class="bordered"><tbody><tr class="header"><th>Program Name</th><th>Description</th><th>Example Usage</th></tr>
<tr><td>infotocap</td><td>convert a terminfo description into a termcap description</td><td><code></code></td></tr>
<tr><td>tic</td><td>the terminfo entry-description compiler</td><td><code></code></td></tr>
<tr><td>toe</td><td>table of (terminfo) entries</td><td><code>toe -a|sort -d</code></td></tr>
<tr><td>infocmp</td><td>compare or print out terminfo descriptions</td><td><code>infocmp -a  -L -1 -T -x</code></td></tr>
<tr><td>capconvert</td><td>automated conversion from termcap to terminfo</td><td><code></code></td></tr>
<tr><td>stty</td><td>prints or changes terminal characteristics, such as baud rate.</td><td><code></code></td></tr>
<tr><td>clear</td><td>clears the terminal's screen</td><td><code></code></td></tr>
<tr><td>capconvert</td><td>automated conversion from termcap to terminfo</td><td><code></code></td></tr>
</tbody></table>


<h3>ALWAYS check out my functions!</h3>
<p>This function will print out the terminal, show it's colors, etc..  I have some really nice ones in this article that I use for tmux, screen, and that sort of thing.</p>
<pre>c ()
{
    tput clear;
    pm "$TERM: [colors:`tput colors`/`tput pairs`]";
    RC=`tput op` L1=$(L &#039;=&#039; $(( ${COLUMNS} - 25 )));
    for i in `seq ${1:-0} ${2:-16}`;
    do
        o="  $i";
        echo -e " ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${L1}${RC}";
    done
}</pre>








<h2>Standard Capabilities</h2>
<h4>X.364 and iBCS2</h4>
<ul>
<li><code>\033c</code> - <var>RIS</var> - full reset</li>
<li><code>\0337</code> - <var>SC</var> - save cursor</li>
<li><code>\0338</code> - <var>RC</var> - restore cursor</li>
<li><code>\033[r</code> - <var>RSR</var> - not an X.364 mnemonic</li>
<li><code>\033[m</code> - <var>SGR0</var> - not an X.364 mnemonic</li>
<li><code>\033[2J</code> - <var>ED2</var> - clear page</li>
</ul>

<h4>Specified by ISO 2022</h4>
<ul>
<li><code>\033(0</code> - <var>ISO DEC G0</var> - enable DEC graphics for G0</li>
<li><code>\033(A</code> - <var>ISO UK G0</var> - enable UK chars for G0</li>
<li><code>\033(B</code> - <var>ISO US G0</var> - enable US chars for G0</li>
<li><code>\033)0</code> - <var>ISO DEC G1</var> - enable DEC graphics for G1</li>
<li><code>\033)A</code> - <var>ISO UK G1</var> - enable UK chars for G1</li>
<li><code>\033)B</code> - <var>ISO US G1</var> - enable US chars for G1</li>
</ul>


<h2>ISO 2022 charset switching:</h2>
<ul>
   <li><a href="http://www.iso.ch/cate/d22747.html">ISO/IEC 2022:1994</a> </li>
   <li>"Character code structure and extension techniques" </li>
   <li><a href="http://www.ecma.ch/stand/ECMA-035.HTM">ECMA-035</a> </li>
   <li>code structure
      <ul>
         <li>=00..=1F C0 set of <a href="iso6429.html">control characters</a> </li>
         <li>=20..=7F G0 set of 94 or 96 <a href="iso646.html">graphic characters</a> </li>
         <li>=80..=9F C1 set of control characters "C1 controls" </li>
         <li>=A0..=FF G1 set of 94 or 96 graphic characters </li>
         <li>... G2 and G3 </li>
      </ul>
   </li>
   <li><a href="http://www.iso.ch/infoe/agency/2375.htm">registration authority</a>
      <ul>
         <li><a href="http://www.iso.ch/cate/d7217.html">ISO/IEC 2375:1985</a> Procedure for registration of escape sequences </li>
         <li>"ECMA registry" </li>
         <li>ISO-IR registration number </li>
         <li><a href="ftp://dkuug.dk/i18n/iso2375reg.txt">ftp://dkuug.dk/i18n/iso2375reg.txt</a> </li>
         <li><a href="http://www.itscj.ipsj.or.jp/ISO-IR/practice/practice.html">Internaltional</a> <a href="http://www.itscj.ipsj.or.jp/ISO-IR/">register of coded character sets to be used with escape sequences</a> </li>
         <li><a href="http://www.dkuug.dk/jtc1/sc2/wg3/">ISO/IEC JTC1/SC2/WG3</a> </li>
      </ul>
   </li>
   <li>ISO-2022 terminals from Siemens </li>
   <li>recode iso-2022..<a href="http://web.archive.org/web/czyborra.com/utf/#UTF-8">utf-8</a> not yet
      implemented </li>
   <li><a href="cjk.html">CJK charsets</a>
      <ul>
         <li><a href="ftp://ftp.isi.edu/in-notes/rfc1458.txt">ISO-2022-JP</a> </li>
         <li><a href="ftp://ftp.isi.edu/in-notes/rfc1554.txt">ISO-2022-JP-2</a> </li>
         <li><a href="ftp://ftp.isi.edu/in-notes/rfc1557.txt">ISO-2022-KR</a> </li>
         <li><a href="ftp://ftp.isi.edu/in-notes/rfc1922.txt">ISO-2022-CN</a> </li>
         <li><a href="ftp://ftp.isi.edu/in-notes/rfc1922.txt">ISO-2022-CN-EXT</a> </li>
      </ul>
   </li>
</ul>


<h4>DEC private controls widely supported by emulators</h4>
<ul>
<li><code>\033=</code> - <var>DECPAM</var> - application keypad mode</li>
<li><code>\033&gt;</code> - <var>DECPNM</var> - normal keypad mode</li>
<li><code>\033&lt;</code> - <var>DECANSI</var> - enter ANSI mode</li>
<li><code>\033[!p</code> - <var>DECSTR</var> - soft reset</li>
<li><code>\033 F</code> - <var>S7C1T</var> - 7-bit controls</li>
</ul>


<h3>ECMA modes</h3>
<h4>ISO 2022</h4>
<ul>
<li><code>2</code> - <var>AM</var> - keyboard action mode</li>
<li><code>4</code> - <var>IRM</var> - insert/replace mode</li>
<li><code>12</code> - <var>SRM</var> - send/receive mode</li>
<li><code>20</code> - <var>LNM</var> - linefeed mode</li>
</ul>

<h3>DEC modes</h3>
<ul>
<li><code>1</code> - <var>CKM</var> - application cursor keys</li>
<li><code>2</code> - <var>ANM</var> - set VT52 mode</li>
<li><code>3</code> - <var>COLM</var> - 132-column mode</li>
<li><code>4</code> - <var>SCLM</var> - smooth scroll</li>
<li><code>5</code> - <var>SCNM</var> - reverse video mode</li>
<li><code>6</code> - <var>OM</var> - origin mode</li>
<li><code>7</code> - <var>AWM</var> - wraparound mode</li>
<li><code>8</code> - <var>ARM</var> - auto-repeat mode</li>
</ul>

<h3>ECMA attribute sequences</h3>
<ul>
<li><var>0</var> - <code>NORMAL</code> - normal</li>
<li><var>1</var> - <code>+BOLD</code> - bold on</li>
<li><var>2</var> - <code>+DIM</code> - dim on</li>
<li><var>3</var> - <code>+ITALIC</code> - italic on</li>
<li><var>4</var> - <code>+UNDERLINE</code> - underline on</li>
<li><var>5</var> - <code>+BLINK</code> - blink on</li>
<li><var>6</var> - <code>+FASTBLINK</code> - fastblink on</li>
<li><var>7</var> - <code>+REVERSE</code> - reverse on</li>
<li><var>8</var> - <code>+INVISIBLE</code> - invisible on</li>
<li><var>9</var> - <code>+DELETED</code> - deleted on</li>
<li><var>10</var> - <code>MAIN-FONT</code> - select primary font</li>
<li><var>11</var> - <code>ALT-FONT-1</code> - select alternate font 1</li>
<li><var>12</var> - <code>ALT-FONT-2</code> - select alternate font 2</li>
<li><var>13</var> - <code>ALT-FONT-3</code> - select alternate font 3</li>
<li><var>14</var> - <code>ALT-FONT-4</code> - select alternate font 4</li>
<li><var>15</var> - <code>ALT-FONT-5</code> - select alternate font 5</li>
<li><var>16</var> - <code>ALT-FONT-6</code> - select alternate font 6</li>
<li><var>17</var> - <code>ALT-FONT-7</code> - select alternate font 7</li>
<li><var>18</var> - <code>ALT-FONT-1</code> - select alternate font 1</li>
<li><var>19</var> - <code>ALT-FONT-1</code> - select alternate font 1</li>
<li><var>20</var> - <code>FRAKTUR</code> - Fraktur font</li>
<li><var>21</var> - <code>DOUBLEUNDER</code> - double underline</li>
<li><var>22</var> - <code>-DIM</code> - dim off</li>
<li><var>23</var> - <code>-ITALIC</code> - italic off</li>
<li><var>24</var> - <code>-UNDERLINE</code> - underline off</li>
<li><var>25</var> - <code>-BLINK</code> - blink off</li>
<li><var>26</var> - <code>-FASTBLINK</code> - fastblink off</li>
<li><var>27</var> - <code>-REVERSE</code> - reverse off</li>
<li><var>28</var> - <code>-INVISIBLE</code> - invisible off</li>
<li><var>29</var> - <code>-DELETED</code> - deleted off</li>
</ul>



<h3>Init strings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><var>is1</var></td><td>init_1string</td></tr>
<tr><td><var>is2</var></td><td>init_2string</td></tr>
<tr><td><var>is3</var></td><td>init_3string</td></tr>
<tr><td><var>rs1</var></td><td>reset_1string</td></tr>
<tr><td><var>rs2</var></td><td>reset_2string</td></tr>
<tr><td><var>rs3</var></td><td>reset_3string</td></tr>
<tr><td><var>smcup</var></td><td>enter_ca_mode</td></tr>
<tr><td><var>rmcup</var></td><td>exit_ca_mode</td></tr>
</tbody></table>

<h3>Cap strings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>so</td><td>String of commands to enter standout mode.</td></tr>
<tr><td>se</td><td>String of commands to leave standout mode.</td></tr>
<tr><td>sg</td><td>Numeric capability, the width on the screen of the magic cookie.  This capability is absent in terminals that record appearance modes character by character.</td></tr>
<tr><td>ms</td><td>Flag whose presence means that it is safe to move the cursor while the appearance modes are not in the normal state.  If this flag is absent, programs should always reset the appearance modes to normal before moving the cursor.</td></tr>
<tr><td>xs</td><td>Flag whose presence means that the only way to reset appearance modes already on the screen is to clear to end of line.  On a per-character terminal, you must clear the area where the modes are set.  On a magic cookie terminal, you must clear an area containing the cookie. See the discussion above.</td></tr>
<tr><td>xt</td><td>Flag whose presence means that the cursor cannot be positioned right in front of a magic cookie, and that seis a command to delete the next magic cookie following the cursor.  See discussion above.</td></tr>
<tr><td>mb</td><td>String of commands to enter blinking mode.</td></tr>
<tr><td>md</td><td>String of commands to enter double-bright mode.</td></tr>
<tr><td>mh</td><td>String of commands to enter half-bright mode.</td></tr>
<tr><td>mk</td><td>String of commands to enter invisible mode.</td></tr>
<tr><td>mp</td><td>String of commands to enter protected mode.</td></tr>
<tr><td>mr</td><td>String of commands to enter reverse-video mode.</td></tr>
<tr><td>me</td><td>String of commands to turn off all appearance modes, including standout mode and underline mode.  On some terminals it also turns off alternate character set mode; on others, it may not.  This capability must be present if any of mb<small>...</small> mris present.</td></tr>
<tr><td>as</td><td>String of commands to turn on alternate character set mode.  This mode assigns some or all graphic characters an alternate picture on the screen.  There is no standard as to what the alternate pictures look like.</td></tr>
<tr><td>ae</td><td>String of commands to turn off alternate character set mode.</td></tr>
<tr><td>sa</td><td>String of commands to turn on an arbitrary combination of appearance modes.  It accepts 9 parameters, each of which controls a particular kind of appearance mode.  A parameter should be 1 to turn its appearance mode on, or zero to turn that mode off.  Most terminals do not support the sacapability, even among those that do have various appearance modes.  The nine parameters are, in order,
<ol>
<li><var>standout</var></li><li><var>underline</var> </li><li><var>reverse</var> </li><li><var>blink</var> </li><li><var>half-bright</var> </li><li><var>double-bright</var> </li><li><var>blank</var> </li><li><var>protect</var> </li><li><var>alt char set</var> </li>
</ol>
</td></tr>
</tbody></table>



<h2>Variable and Function Index</h2>
<p>For stty</p>
<ul>
<li><code>BC</code>: tgoto</li>
<li><code>ospeed</code>: Output Padding</li>
<li><code>PC</code>: Output Padding</li>
<li><code>tgetent</code>: Find</li>
<li><code>tgetflag</code>: Interrogate</li>
<li><code>tgetnum</code>: Interrogate</li>
<li><code>tgetstr</code>: Interrogate</li>
<li><code>tgoto</code>: tgoto</li>
<li><code>tparam</code>: tparam</li>
<li><code>tputs</code>: Output Padding</li>
<li><code>UP</code>: tgoto</li>
</ul>


<h2>Summary of Capability Names</h2>
<p>Here are all the terminal capability names in alphabetical order with a brief description of each.  For cross references to their definitions, see the index of capability names.</p>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>ae</td><td>String to turn off alternate character set mode.</td></tr>
<tr><td>al</td><td>String to insert a blank line before the cursor.</td></tr>
<tr><td>AL</td><td>String to insert <var>n</var> blank lines before the cursor.</td></tr>
<tr><td>am</td><td>Flag: output to last column wraps cursor to next line.</td></tr>
<tr><td>as</td><td>String to turn on alternate character set mode.like.</td></tr>
<tr><td>bc</td><td>Very obsolete alternative name for the lecapability.</td></tr>
<tr><td>bl</td><td>String to sound the bell.</td></tr>
<tr><td>bs</td><td>Obsolete flag: ASCII backspace may be used for leftward motion.</td></tr>
<tr><td>bt</td><td>String to move the cursor left to the previous hardware tab stop column.</td></tr>
<tr><td>bw</td><td>Flag: leat left margin wraps to end of previous line.</td></tr>
<tr><td>CC</td><td>String to change terminal's command character.</td></tr>
<tr><td>cd</td><td>String to clear the line the cursor is on, and following lines.</td></tr>
<tr><td>ce</td><td>String to clear from the cursor to the end of the line.</td></tr>
<tr><td>ch</td><td>String to position the cursor at column <var>c</var> in the same line.</td></tr>
<tr><td>cl</td><td>String to clear the entire screen and put cursor at upper left corner.</td></tr>
<tr><td>cm</td><td>String to position the cursor at line <var>l</var>, column <var>c</var>.</td></tr>
<tr><td>CM</td><td>String to position the cursor at line <var>l</var>, column <var>c</var>, relative to display memory.</td></tr>
<tr><td>co</td><td>Number: width of the screen.</td></tr>
<tr><td>cr</td><td>String to move cursor sideways to left margin.</td></tr>
<tr><td>cs</td><td>String to set the scroll region.</td></tr>
<tr><td>cS</td><td>Alternate form of string to set the scroll region.</td></tr>
<tr><td>ct</td><td>String to clear all tab stops.</td></tr>
<tr><td>cv</td><td>String to position the cursor at line <var>l</var> in the same column.</td></tr>
<tr><td>da</td><td>Flag: data scrolled off top of screen may be scrolled back.</td></tr>
<tr><td>db</td><td>Flag: data scrolled off bottom of screen may be scrolled back.</td></tr>
<tr><td>dB</td><td>Obsolete number: msec of padding needed for the backspace character.</td></tr>
<tr><td>dc</td><td>String to delete one character position at the cursor.</td></tr>
<tr><td>dC</td><td>Obsolete number: msec of padding needed for the carriage-return character.</td></tr>
<tr><td>DC</td><td>String to delete <var>n</var> characters starting at the cursor.</td></tr>
<tr><td>dF</td><td>Obsolete number: msec of padding needed for the formfeed character.</td></tr>
<tr><td>dl</td><td>String to delete the line the cursor is on.</td></tr>
<tr><td>DL</td><td>String to delete <var>n</var> lines starting with the cursor's line.</td></tr>
<tr><td>dm</td><td>String to enter delete mode.</td></tr>
<tr><td>dN</td><td>Obsolete number: msec of padding needed for the newline character.</td></tr>
<tr><td>do</td><td>String to move the cursor vertically down one line.</td></tr>
<tr><td>DO</td><td>String to move cursor vertically down <var>n</var> lines.</td></tr>
<tr><td>ds</td><td>String to disable the display of the status line.</td></tr>
<tr><td>dT</td><td>Obsolete number: msec of padding needed for the tab character.</td></tr>
<tr><td>ec</td><td>String of commands to clear <var>n</var> characters at cursor.</td></tr>
<tr><td>ed</td><td>String to exit delete mode.</td></tr>
<tr><td>ei</td><td>String to leave insert mode.</td></tr>
<tr><td>eo</td><td>Flag: output of a space can erase an overstrike.</td></tr>
<tr><td>es</td><td>Flag: other display commands work while writing the status line.</td></tr>
<tr><td>ff</td><td>String to advance to the next page, for a hardcopy terminal.</td></tr>
<tr><td>fs</td><td>String to move the cursor back from the status line to its previous position (outside the status line).</td></tr>
<tr><td>gn</td><td>Flag: this terminal type is generic, not real.</td></tr>
<tr><td>hc</td><td>Flag: hardcopy terminal.</td></tr>
<tr><td>hd</td><td>String to move the cursor down half a line.</td></tr>
<tr><td>ho</td><td>String to position cursor at upper left corner.</td></tr>
<tr><td>hs</td><td>Flag: the terminal has a status line.</td></tr>
<tr><td>hu</td><td>String to move the cursor up half a line.</td></tr>
<tr><td>hz</td><td>Flag: terminal cannot accept ~as output.</td></tr>
<tr><td>i1</td><td>String to initialize the terminal for each login session.</td></tr>
<tr><td>i3</td><td>String to initialize the terminal for each login session.</td></tr>
<tr><td>ic</td><td>String to insert one character position at the cursor.</td></tr>
<tr><td>IC</td><td>String to insert <var>n</var> character positions at the cursor.</td></tr>
<tr><td>if</td><td>String naming a file of commands to initialize the terminal.</td></tr>
<tr><td>im</td><td>String to enter insert mode.</td></tr>
<tr><td>in</td><td>Flag: outputting a space is different from moving over empty positions.</td></tr>
<tr><td>ip</td><td>String to output following an inserted character in insert mode.</td></tr>
<tr><td>is</td><td>String to initialize the terminal for each login session.</td></tr>
<tr><td>it</td><td>Number: initial spacing between hardware tab stop columns.</td></tr>
<tr><td>k0</td><td>String of input sent by function key 0 or 10.</td></tr>
<tr><td>k1 ... k9</td><td>Strings of input sent by function keys 1 through 9.</td></tr>
<tr><td>K1 ... K5</td><td>Strings sent by the five other keys in 3-by-3 array with arrows.</td></tr>
<tr><td>ka</td><td>String of input sent by the “clear all tabs” key.</td></tr>
<tr><td>kA</td><td>String of input sent by the “insert line” key.</td></tr>
<tr><td>kb</td><td>String of input sent by the “backspace” key.</td></tr>
<tr><td>kC</td><td>String of input sent by the “clear screen” key.</td></tr>
<tr><td>kd</td><td>String of input sent by typing the down-arrow key.</td></tr>
<tr><td>kD</td><td>String of input sent by the “delete character” key.</td></tr>
<tr><td>ke</td><td>String to make the function keys work locally.</td></tr>
<tr><td>kE</td><td>String of input sent by the “clear to end of line” key.</td></tr>
<tr><td>kF</td><td>String of input sent by the “scroll forward” key.</td></tr>
<tr><td>kh</td><td>String of input sent by typing the “home-position” key.</td></tr>
<tr><td>kH</td><td>String of input sent by the “home down” key.</td></tr>
<tr><td>kI</td><td>String of input sent by the “insert character” or “enter insert mode” key.</td></tr>
<tr><td>kl</td><td>String of input sent by typing the left-arrow key.</td></tr>
<tr><td>kL</td><td>String of input sent by the “delete line” key.</td></tr>
<tr><td>km</td><td>Flag: the terminal has a Meta key.</td></tr>
<tr><td>kM</td><td>String of input sent by the “exit insert mode” key.</td></tr>
<tr><td>kn</td><td>Numeric value, the number of numbered function keys.</td></tr>
<tr><td>kN</td><td>String of input sent by the “next page” key.</td></tr>
<tr><td>ko</td><td>Very obsolete string listing the terminal's named function keys.</td></tr>
<tr><td>kP</td><td>String of input sent by the “previous page” key.</td></tr>
<tr><td>kr</td><td>String of input sent by typing the right-arrow key.</td></tr>
<tr><td>kR</td><td>String of input sent by the “scroll reverse” key.</td></tr>
<tr><td>ks</td><td>String to make the function keys transmit.</td></tr>
<tr><td>kS</td><td>String of input sent by the “clear to end of screen” key.</td></tr>
<tr><td>kt</td><td>String of input sent by the “clear tab stop this column” key.</td></tr>
<tr><td>kT</td><td>String of input sent by the “set tab stop in this column” key.</td></tr>
<tr><td>ku</td><td>String of input sent by typing the up-arrow key.</td></tr>
<tr><td>l0</td><td>String on keyboard labelling function key 0 or 10.</td></tr>
<tr><td>l1 ... l9</td><td>Strings on keyboard labelling function keys 1 through 9.</td></tr>
<tr><td>le</td><td>String to move the cursor left one column.</td></tr>
<tr><td>LE</td><td>String to move cursor left <var>n</var> columns.</td></tr>
<tr><td>li</td><td>Number: height of the screen.</td></tr>
<tr><td>ll</td><td>String to position cursor at lower left corner.</td></tr>
<tr><td>lm</td><td>Number: lines of display memory.</td></tr>
<tr><td>LP</td><td>Flag: writing to last column of last line will not scroll.</td></tr>
<tr><td>mb</td><td>String to enter blinking mode.</td></tr>
<tr><td>md</td><td>String to enter double-bright mode.</td></tr>
<tr><td>me</td><td>String to turn off all appearance modes</td></tr>
<tr><td>mh</td><td>String to enter half-bright mode.</td></tr>
<tr><td>mi</td><td>Flag: cursor motion in insert mode is safe.</td></tr>
<tr><td>mk</td><td>String to enter invisible mode.</td></tr>
<tr><td>mm</td><td>String to enable the functioning of the Meta key.</td></tr>
<tr><td>mo</td><td>String to disable the functioning of the Meta key.</td></tr>
<tr><td>mp</td><td>String to enter protected mode.</td></tr>
<tr><td>mr</td><td>String to enter reverse-video mode.</td></tr>
<tr><td>ms</td><td>Flag: cursor motion in standout mode is safe.</td></tr>
<tr><td>nc</td><td>Obsolete flag: do not use ASCII carriage-return on this terminal.</td></tr>
<tr><td>nd</td><td>String to move the cursor right one column.</td></tr>
<tr><td>NF</td><td>Flag: do not use XON/XOFF flow control.</td></tr>
<tr><td>nl</td><td>Obsolete alternative name for the doand sfcapabilities.</td></tr>
<tr><td>ns</td><td>Flag: the terminal does not normally scroll for sequential output.</td></tr>
<tr><td>nw</td><td>String to move to start of next line, possibly clearing rest of old line.</td></tr>
<tr><td>os</td><td>Flag: terminal can overstrike.</td></tr>
<tr><td>pb</td><td>Number: the lowest baud rate at which padding is actually needed.</td></tr>
<tr><td>pc</td><td>String containing character for padding.</td></tr>
<tr><td>pf</td><td>String to terminate redirection of output to the printer.</td></tr>
<tr><td>po</td><td>String to redirect further output to the printer.</td></tr>
<tr><td>pO</td><td>String to redirect <var>n</var> characters ofoutput to the printer.</td></tr>
<tr><td>ps</td><td>String to print the screen on the attached printer.</td></tr>
<tr><td>rc</td><td>String to move to last saved cursor position.</td></tr>
<tr><td>RI</td><td>String to move cursor right <var>n</var> columns.</td></tr>
<tr><td>rp</td><td>String to output character <var>c</var> repeated <var>n</var> times.</td></tr>
<tr><td>rs</td><td>String to reset the terminal from any strange modes.</td></tr>
<tr><td>sa</td><td>String to turn on an arbitrary combination of appearance modes.</td></tr>
<tr><td>sc</td><td>String to save the current cursor position.</td></tr>
<tr><td>se</td><td>String to leave standout mode.</td></tr>
<tr><td>sf</td><td>String to scroll the screen one line up.</td></tr>
<tr><td>SF</td><td>String to scroll the screen <var>n</var> lines up.</td></tr>
<tr><td>sg</td><td>Number: width of magic standout cookie.  Absent if magic cookies are not used.</td></tr>
<tr><td>so</td><td>String to enter standout mode.</td></tr>
<tr><td>sr</td><td>String to scroll the screen one line down.</td></tr>
<tr><td>SR</td><td>String to scroll the screen <var>n</var> line down.</td></tr>
<tr><td>st</td><td>String to set tab stop at current cursor column on all lines. programs.</td></tr>
<tr><td>ta</td><td>String to move the cursor right to the next hardware tab stop column.</td></tr>
<tr><td>te</td><td>String to return terminal to settings for sequential output.</td></tr>
<tr><td>ti</td><td>String to initialize terminal for random cursor motion.</td></tr>
<tr><td>ts</td><td>String to move the terminal cursor into the status line.</td></tr>
<tr><td>uc</td><td>String to underline one character and move cursor right.</td></tr>
<tr><td>ue</td><td>String to turn off underline mode</td></tr>
<tr><td>ug</td><td>Number: width of underlining magic cookie.  Absent if underlining doesn't use magic cookies.</td></tr>
<tr><td>ul</td><td>Flag: underline by overstriking with an underscore.</td></tr>
<tr><td>up</td><td>String to move the cursor vertically up one line.</td></tr>
<tr><td>UP</td><td>String to move cursor vertically up <var>n</var> lines.</td></tr>
<tr><td>us</td><td>String to turn on underline mode</td></tr>
<tr><td>vb</td><td>String to make the screen flash.</td></tr>
<tr><td>ve</td><td>String to return the cursor to normal.</td></tr>
<tr><td>vi</td><td>String to make the cursor invisible.</td></tr>
<tr><td>vs</td><td>String to enhance the cursor.</td></tr>
<tr><td>wi</td><td>String to set the terminal output screen window.</td></tr>
<tr><td>ws</td><td>Number: the width of the status line.</td></tr>
<tr><td>xb</td><td>Flag: superbee terminal.</td></tr>
<tr><td>xn</td><td>Flag: cursor wraps in a strange way.</td></tr>
<tr><td>xs</td><td>Flag: clearing a line is the only way to clear the appearance modes of positions in that line (or, only way to remove magic cookies on that line).</td></tr>
<tr><td>xt</td><td>Flag: Teleray 1061; several strange characteristics.</td></tr>
</tbody></table>

<h2>Variable and Function Index</h2>
<ul>
<li><code>BC</code>: tgoto</li>
<li><code>ospeed</code>: Output Padding</li>
<li><code>PC</code>: Output Padding</li>
<li><code>tgetent</code>: Find</li>
<li><code>tgetflag</code>: Interrogate</li>
<li><code>tgetnum</code>: Interrogate</li>
<li><code>tgetstr</code>: Interrogate</li>
<li><code>tgoto</code>: tgoto</li>
<li><code>tparam</code>: tparam</li>
<li><code>tputs</code>: Output Padding</li>
<li><code>UP</code>: tgoto</li>
</ul>

<hr class="HR" />

<ul>
<li><code>ae</code>: Standout</li>
<li><code>AL</code>: Insdel Line</li>
<li><code>al</code>: Insdel Line</li>
<li><code>am</code>: Wrapping</li>
<li><code>as</code>: Standout</li>
<li><code>bc</code>: Cursor Motion</li>
<li><code>bl</code>: Bell</li>
<li><code>bs</code>: Cursor Motion</li>
<li><code>bt</code>: Cursor Motion</li>
<li><code>bw</code>: Cursor Motion</li>
<li><code>CC</code>: Basic</li>
<li><code>cd</code>: Clearing</li>
<li><code>ce</code>: Clearing</li>
<li><code>ch</code>: Cursor Motion</li>
<li><code>cl</code>: Clearing</li>
<li><code>CM</code>: Cursor Motion</li>
<li><code>cm</code>: Cursor Motion</li>
<li><code>co</code>: Screen Size</li>
<li><code>cr</code>: Cursor Motion</li>
<li><code>cS</code>: Scrolling</li>
<li><code>cs</code>: Scrolling</li>
<li><code>ct</code>: Initialization</li>
<li><code>cv</code>: Cursor Motion</li>
<li><code>da</code>: Scrolling</li>
<li><code>dB</code>: Pad Specs</li>
<li><code>db</code>: Scrolling</li>
<li><code>dC</code>: Pad Specs</li>
<li><code>DC</code>: Insdel Char</li>
<li><code>dc</code>: Insdel Char</li>
<li><code>dF</code>: Pad Specs</li>
<li><code>DL</code>: Insdel Line</li>
<li><code>dl</code>: Insdel Line</li>
<li><code>dm</code>: Insdel Char</li>
<li><code>dN</code>: Pad Specs</li>
<li><code>DO</code>: Cursor Motion</li>
<li><code>do</code>: Cursor Motion</li>
<li><code>ds</code>: Status Line</li>
<li><code>dT</code>: Pad Specs</li>
<li><code>ec</code>: Clearing</li>
<li><code>ed</code>: Insdel Char</li>
<li><code>ei</code>: Insdel Char</li>
<li><code>eo</code>: Basic</li>
<li><code>es</code>: Status Line</li>
<li><code>ff</code>: Cursor Motion</li>
<li><code>fs</code>: Status Line</li>
<li><code>gn</code>: Basic</li>
<li><code>hc</code>: Basic</li>
<li><code>hd</code>: Half-Line</li>
<li><code>ho</code>: Cursor Motion</li>
<li><code>hs</code>: Status Line</li>
<li><code>hu</code>: Half-Line</li>
<li><code>hz</code>: Basic</li>
<li><code>i1</code>: Initialization</li>
<li><code>i3</code>: Initialization</li>
<li><code>IC</code>: Insdel Char</li>
<li><code>ic</code>: Insdel Char</li>
<li><code>if</code>: Initialization</li>
<li><code>im</code>: Insdel Char</li>
<li><code>in</code>: Insdel Char</li>
<li><code>ip</code>: Insdel Char</li>
<li><code>is</code>: Initialization</li>
<li><code>it</code>: Initialization</li>
<li><code>K1...K5</code>: Keypad</li>
<li><code>k1...k9</code>: Keypad</li>
<li><code>kA...kT</code>: Keypad</li>
<li><code>ka...ku</code>: Keypad</li>
<li><code>km</code>: Meta Key</li>
<li><code>l0...l9</code>: Keypad</li>
<li><code>LE</code>: Cursor Motion</li>
<li><code>le</code>: Cursor Motion</li>
<li><code>li</code>: Screen Size</li>
<li><code>ll</code>: Cursor Motion</li>
<li><code>lm</code>: Scrolling</li>
<li><code>LP</code>: Wrapping</li>
<li><code>mb</code>: Standout</li>
<li><code>md</code>: Standout</li>
<li><code>me</code>: Standout</li>
<li><code>mh</code>: Standout</li>
<li><code>mi</code>: Insdel Char</li>
<li><code>mk</code>: Standout</li>
<li><code>mm</code>: Meta Key</li>
<li><code>mo</code>: Meta Key</li>
<li><code>mp</code>: Standout</li>
<li><code>mr</code>: Standout</li>
<li><code>ms</code>: Underlining</li>
<li><code>ms</code>: Standout</li>
<li><code>nc</code>: Cursor Motion</li>
<li><code>nd</code>: Cursor Motion</li>
<li><code>NF</code>: Initialization</li>
<li><code>nl</code>: Cursor Motion</li>
<li><code>ns</code>: Scrolling</li>
<li><code>nw</code>: Cursor Motion</li>
<li><code>os</code>: Basic</li>
<li><code>pb</code>: Pad Specs</li>
<li><code>pc</code>: Pad Specs</li>
<li><code>pf</code>: Printer</li>
<li><code>pO</code>: Printer</li>
<li><code>po</code>: Printer</li>
<li><code>ps</code>: Printer</li>
<li><code>rc</code>: Cursor Motion</li>
<li><code>RI</code>: Cursor Motion</li>
<li><code>rp</code>: Basic</li>
<li><code>rs</code>: Initialization</li>
<li><code>sa</code>: Standout</li>
<li><code>sc</code>: Cursor Motion</li>
<li><code>se</code>: Standout</li>
<li><code>SF</code>: Scrolling</li>
<li><code>sf</code>: Scrolling</li>
<li><code>sg</code>: Standout</li>
<li><code>so</code>: Standout</li>
<li><code>SR</code>: Scrolling</li>
<li><code>sr</code>: Scrolling</li>
<li><code>st</code>: Initialization</li>
<li><code>ta</code>: Cursor Motion</li>
<li><code>te</code>: Initialization</li>
<li><code>ti</code>: Initialization</li>
<li><code>ts</code>: Status Line</li>
<li><code>uc</code>: Underlining</li>
<li><code>ue</code>: Underlining</li>
<li><code>ug</code>: Underlining</li>
<li><code>ul</code>: Underlining</li>
<li><code>UP</code>: Cursor Motion</li>
<li><code>up</code>: Cursor Motion</li>
<li><code>us</code>: Underlining</li>
<li><code>vb</code>: Bell</li>
<li><code>ve</code>: Cursor Visibility</li>
<li><code>vi</code>: Cursor Visibility</li>
<li><code>vs</code>: Cursor Visibility</li>
<li><code>wi</code>: Windows</li>
<li><code>ws</code>: Status Line</li>
<li><code>xb</code>: Basic</li>
<li><code>xn</code>: Wrapping</li>
<li><code>xs</code>: Standout</li>
<li><code>xt</code>: Standout</li>
<li><code>xt</code>: Cursor Motion</li>
</ul>





<hr class="HR" />

<ul>
<li>Basic:        Basic characteristics.</li>
<li>Screen Size:   Screen size, and what happens when it changes.</li>
<li>Cursor Motion:   Various ways to move the cursor.</li>
<li>Wrapping:     What happens if you write a character in the last column.</li>
<li>Scrolling:    Pushing text up and down on the screen.</li>
<li>Windows:      Limiting the part of the window that output affects.</li>
<li>Clearing:     Erasing one or many lines.</li>
<li>Insdel Line:   Making new blank lines in mid-screen; deleting lines.</li>
<li>Insdel Char:   Inserting and deleting characters within a line.</li>
<li>Standout:     Highlighting some of the text.</li>
<li>Underlining:   Underlining some of the text.</li>
<li>Cursor Visibility:   Making the cursor more or less easy to spot.</li>
<li>Bell:         Attracts user's attention; not localized on the screen.</li>
<li>Keypad:  Recognizing when function keys or arrows are typed.</li>
<li>Meta Key:     META acts like an extra shift key.</li>
<li>Initialization:   Commands used to initialize or reset the terminal.</li>
<li>Pad Specs:    Info for the kernel on how much padding is needed.</li>
<li>Status Line:   A status line displays <code>background</code> information.</li>
<li>Half-Line:    Moving by half-lines, for superscripts and subscripts.</li>
<li>Printer:      Controlling auxiliary printers of display terminals.</li>
</ul>
<hr class="HR" />





<h2>Translated Term Capabilities</h2>
<pre></pre>
<p>This is helpful so you can understand what a term cap does, by looking at the long name.</p>
<table class="bordered"><tbody><tr class="header"><th>Tput Name</th><th>Terminfo Long Name</th></tr>
<tr><td>@7</td><td>key_end</td></tr><tr><td>AB</td><td>set_a_background</td></tr><tr><td>AF</td><td>set_a_foreground</td></tr><tr><td>AL</td><td>parm_insert_line</td></tr><tr><td>AX</td><td>AX</td></tr><tr><td>Co</td><td>max_colors</td></tr><tr><td>DC</td><td>parm_dch</td></tr><tr><td>DL</td><td>parm_delete_line</td></tr><tr><td>DO</td><td>parm_down_cursor</td></tr><tr><td>E0</td><td>E0</td></tr><tr><td>F1</td><td>key_f11</td></tr><tr><td>F2</td><td>key_f12</td></tr><tr><td>G0</td><td>G0</td></tr><tr><td>HC</td><td>5i</td></tr><tr><td>IC</td><td>parm_ich</td></tr><tr><td>Ic</td><td>initialize_color</td></tr><tr><td>Km</td><td>delete_line</td></tr><tr><td>LE</td><td>parm_left_cursor</td></tr><tr><td>NC</td><td>no_color_video</td></tr><tr><td>ND</td><td>MT</td></tr><tr><td>NP</td><td>NL</td></tr><tr><td>RI</td><td>parm_right_cursor</td></tr><tr><td>S0</td><td>S0</td></tr><tr><td>UP</td><td>parm_up_cursor</td></tr><tr><td>YA</td><td>NR</td></tr><tr><td>YC</td><td>YB</td></tr><tr><td>YE</td><td>YD</td></tr><tr><td>YG</td><td>YF</td></tr><tr><td>ac</td><td>acs_chars</td></tr><tr><td>ae</td><td>exit_alt_charset_mode</td></tr><tr><td>al</td><td>insert_line</td></tr><tr><td>am</td><td>auto_right_margin</td></tr><tr><td>as</td><td>enter_alt_charset_mode</td></tr><tr><td>back_color_erase</td><td>backspaces_with_bs</td></tr><tr><td>bl</td><td>bell</td></tr><tr><td>bs</td><td>eat_newline_glitch</td></tr><tr><td>bt</td><td>back_tab</td></tr><tr><td>bw</td><td>auto_left_margin</td></tr><tr><td>cb</td><td>clr_bol</td></tr><tr><td>cc</td><td>can_change</td></tr><tr><td>cd</td><td>clr_eos</td></tr><tr><td>ce</td><td>clr_eol</td></tr><tr><td>cl</td><td>clear_screen</td></tr><tr><td>cm</td><td>cursor_address</td></tr><tr><td>co</td><td>columns</td></tr><tr><td>col_addr_glitch</td><td>ceol_standout_glitch</td></tr><tr><td>cpi_changes_res</td><td>cr_cancels_micro_mode</td></tr><tr><td>cr</td><td>carriage_return</td></tr><tr><td>cs</td><td>change_scroll_region</td></tr><tr><td>ct</td><td>clear_all_tabs</td></tr><tr><td>cursor_up</td><td>scroll_reverse</td></tr><tr><td>da</td><td>crt_no_scrolling</td></tr><tr><td>db</td><td>dest_tabs_magic_smso</td></tr><tr><td>dc</td><td>delete_character</td></tr><tr><td>dl</td><td>key_mouse</td></tr><tr><td>do</td><td>cursor_down</td></tr><tr><td>eA</td><td>ena_acs</td></tr><tr><td>ei</td><td>exit_insert_mode</td></tr><tr><td>eo</td><td>erase_overstrike</td></tr><tr><td>es</td><td>generic_type</td></tr><tr><td>gn</td><td>gnu_has_meta_key</td></tr><tr><td>hard_copy</td><td>hard_cursor</td></tr><tr><td>has_meta_key</td><td>has_hardware_tabs</td></tr><tr><td>has_status_line</td><td>has_print_wheel</td></tr><tr><td>hl</td><td>hc</td></tr><tr><td>ho</td><td>cursor_home</td></tr><tr><td>hs</td><td>hue_lightness_saturation</td></tr><tr><td>im</td><td>enter_insert_mode</td></tr><tr><td>in</td><td>hz</td></tr><tr><td>insert_null_glitch</td><td>linefeed_is_newline</td></tr><tr><td>is</td><td>init_2string</td></tr><tr><td>it</td><td>init_tabs</td></tr><tr><td>k1</td><td>key_f1</td></tr><tr><td>k2</td><td>key_f2</td></tr><tr><td>k3</td><td>key_f3</td></tr><tr><td>k4</td><td>key_f4</td></tr><tr><td>k5</td><td>key_f5</td></tr><tr><td>k6</td><td>key_f6</td></tr><tr><td>k7</td><td>key_f7</td></tr><tr><td>k8</td><td>key_f8</td></tr><tr><td>k9</td><td>key_f9</td></tr><tr><td>k;</td><td>key_f10</td></tr><tr><td>kB</td><td>key_btab</td></tr><tr><td>kD</td><td>key_dc</td></tr><tr><td>kI</td><td>key_ic</td></tr><tr><td>kN</td><td>key_npage</td></tr><tr><td>kP</td><td>key_ppage</td></tr><tr><td>kb</td><td>cursor_left</td></tr><tr><td>kd</td><td>key_down</td></tr><tr><td>ke</td><td>keypad_local</td></tr><tr><td>kh</td><td>key_home</td></tr><tr><td>kl</td><td>key_left</td></tr><tr><td>kr</td><td>key_right</td></tr><tr><td>ks</td><td>keypad_xmit</td></tr><tr><td>ku</td><td>key_up</td></tr><tr><td>le</td><td>key_backspace</td></tr><tr><td>li</td><td>lines</td></tr><tr><td>mb</td><td>enter_blink_mode</td></tr><tr><td>md</td><td>enter_bold_mode</td></tr><tr><td>me</td><td>exit_attribute_mode</td></tr><tr><td>memory_above</td><td>lpi_changes_res</td></tr><tr><td>mi</td><td>km</td></tr><tr><td>move_insert_mode</td><td>move_standout_mode</td></tr><tr><td>mr</td><td>enter_reverse_mode</td></tr><tr><td>nc</td><td>memory_below</td></tr><tr><td>nd</td><td>cursor_right</td></tr><tr><td>needs_xon_xoff</td><td>no_correctly_working_cr</td></tr><tr><td>no_pad_char</td><td>no_esc_ctlc</td></tr><tr><td>non_rev_rmcup</td><td>non_dest_scroll_region</td></tr><tr><td>nw</td><td>newline</td></tr><tr><td>nx</td><td>ns</td></tr><tr><td>op</td><td>orig_pair</td></tr><tr><td>os</td><td>over_strike</td></tr><tr><td>pa</td><td>max_pairs</td></tr><tr><td>prtr_silent</td><td>return_does_clr_eol</td></tr><tr><td>pt</td><td>ms</td></tr><tr><td>r2</td><td>reset_2string</td></tr><tr><td>rc</td><td>restore_cursor</td></tr><tr><td>row_addr_glitch</td><td>semi_auto_right_margin</td></tr><tr><td>sa</td><td>set_attributes</td></tr><tr><td>sc</td><td>save_cursor</td></tr><tr><td>se</td><td>exit_standout_mode</td></tr><tr><td>sf</td><td>scroll_forward</td></tr><tr><td>so</td><td>enter_standout_mode</td></tr><tr><td>st</td><td>set_tab</td></tr><tr><td>ta</td><td>tab</td></tr><tr><td>te</td><td>exit_ca_mode</td></tr><tr><td>ti</td><td>enter_ca_mode</td></tr><tr><td>tilde_glitch</td><td>status_line_esc_ok</td></tr><tr><td>ue</td><td>exit_underline_mode</td></tr><tr><td>ul</td><td>transparent_underline</td></tr><tr><td>up</td><td>sr</td></tr><tr><td>us</td><td>enter_underline_mode</td></tr><tr><td>vb</td><td>flash_screen</td></tr><tr><td>ve</td><td>cursor_normal</td></tr><tr><td>vi</td><td>cursor_invisible</td></tr><tr><td>vs</td><td>cursor_visible</td></tr><tr><td>xn</td><td>ut</td></tr><tr><td>xo</td><td>xb</td></tr><tr><td>xr</td><td>xon_xoff</td></tr><tr><td>xt</td><td>xs</td></tr></tbody></table>


<h2>List of All Terminals</h2>
<p>You can view this list with the following command:</p>
<pre>$ toe -a|sort -d</pre>





<h2><a href="http://vt100.net/docs/vt100-ug/chapter3.html#S3.3.2">VT100 keypad Diagram</a></h2>
<p><a href="http://vt100.net/docs/vt100-ug/chapter3.html#S3.3.2">VT100 LINK</a></p>
<p>Here's a diagram of the VT100 keypad keys with their bindings.  The top line is the name of the key (some DEC keyboards have the keys labelled somewhat differently, like GOLD instead of PF1, but this is the most "official" name).  The second line is the escape sequence it generates in Application Keypad mode (where "$" means the ESC character).  The third line contains two items, first the mapping of the key in terminfo, and then in termcap.</p>
<pre>   _______________________________________
  |   PF1   |   PF2   |   PF3   |   PF4   |
  |   $OP   |   $OQ   |   $OR   |   $OS   |
  |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_|
  |    7         8         9         -    |
  |   $Ow   |   $Ox   |   $Oy   |   $Om   |
  |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________|
  |    4    |    5    |    6    |    ,    |
  |   $Ot   |   $Ou   |   $Ov   |   $Ol   |
  |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_|
  |    1    |    2    |    3    |         |
  |   $Oq   |   $Or   |   $Os   |  enter  |
  |_ka1__K1_|_kb2__K2_|_ka3__K3_|  $OM    |
  |         0         |   .     |         |
  |        $Op        |  $On    |         |
  |___kc1_______K4____|_kc3__K5_|_kent_@8_|</pre>

<p>A better adaptation to modern keyboards such as the PC's, which have a dozen function keys and the keypad 2,4,6,8 keys are labeled with arrows keys, is to use the 5-key arrangement to model the arrow keys as suggested in the terminfo guidelines:</p>
<pre>   _______________________________________
  |   PF1   |   PF2   |   PF3   |   PF4   |
  |   $OP   |   $OQ   |   $OR   |   $OS   |
  |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_|
  |    7         8         9         -    |
  |   $Ow   |   $Ox   |   $Oy   |   $Om   |
  |_ka1__K1_|_________|_ka3__K3_|_________|
  |    4    |    5    |    6    |    ,    |
  |   $Ot   |   $Ou   |   $Ov   |   $Ol   |
  |_________|_kb2__K2_|_________|_________|
  |    1    |    2    |    3    |         |
  |   $Oq   |   $Or   |   $Os   |  enter  |
  |_kc1__K4_|_________|_kc3__K5_|  $OM    |
  |         0         |   .     |         |
  |        $Op        |  $On    |         |
  |___________________|_________|_kent_@8_|</pre>





<h2>SGR parameter values</h2>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><var>0</var></td><td>default mode (attributes off)</td></tr>
<tr><td><var>1</var></td><td>bold</td></tr>
<tr><td><var>2</var></td><td>dim</td></tr>
<tr><td><var>3</var></td><td>italicized</td></tr>
<tr><td><var>4</var></td><td>underlined</td></tr>
<tr><td><var>5</var></td><td>slow blink</td></tr>
<tr><td><var>6</var></td><td>fast blink</td></tr>
<tr><td><var>7</var></td><td>reverse video</td></tr>
<tr><td><var>8</var></td><td>invisible</td></tr>
<tr><td><var>9</var></td><td>crossed-out (marked for deletion)</td></tr>
<tr><td><var>10</var></td><td>primary font [10 + n (n in 1..9) = nth alternative font]</td></tr>
<tr><td><var>20</var></td><td>Fraktur</td></tr>
<tr><td><var>21</var></td><td>double underline</td></tr>
<tr><td><var>22</var></td><td>turn off 2</td></tr>
<tr><td><var>23</var></td><td>turn off 3</td></tr>
<tr><td><var>24</var></td><td>turn off 4</td></tr>
<tr><td><var>25</var></td><td>turn off 5</td></tr>
<tr><td><var>26</var></td><td>proportional spacing</td></tr>
<tr><td><var>27</var></td><td>turn off 7</td></tr>
<tr><td><var>28</var></td><td>turn off 8</td></tr>
<tr><td><var>29</var></td><td>turn off 9</td></tr>
<tr><td><var>30</var></td><td>black fg</td></tr>
<tr><td><var>31</var></td><td>red fg</td></tr>
<tr><td><var>32</var></td><td>green fg</td></tr>
<tr><td><var>33</var></td><td>yellow fg</td></tr>
<tr><td><var>34</var></td><td>blue fg</td></tr>
<tr><td><var>35</var></td><td>magenta fg</td></tr>
<tr><td><var>36</var></td><td>cyan fg</td></tr>
<tr><td><var>37</var></td><td>white fg</td></tr>
<tr><td><var>38</var></td><td>set fg color as in CCIT T.416</td></tr>
<tr><td><var>39</var></td><td>set default fg color</td></tr>
<tr><td><var>40</var></td><td>black bg</td></tr>
<tr><td><var>41</var></td><td>red bg</td></tr>
<tr><td><var>42</var></td><td>green bg</td></tr>
<tr><td><var>43</var></td><td>yellow bg</td></tr>
<tr><td><var>44</var></td><td>blue bg</td></tr>
<tr><td><var>45</var></td><td>magenta bg</td></tr>
<tr><td><var>46</var></td><td>cyan bg</td></tr>
<tr><td><var>47</var></td><td>white bg</td></tr>
<tr><td><var>48</var></td><td>set bg color as in CCIT T.416</td></tr>
<tr><td><var>39</var></td><td>set default bg color</td></tr>
<tr><td><var>50</var></td><td>turn off 26</td></tr>
<tr><td><var>51</var></td><td>framed</td></tr>
<tr><td><var>52</var></td><td>encircled</td></tr>
<tr><td><var>53</var></td><td>overlined</td></tr>
<tr><td><var>54</var></td><td>turn off 51 &amp; 52</td></tr>
<tr><td><var>55</var></td><td>not overlined</td></tr>
<tr><td><var>56-59</var></td><td>reserved</td></tr>
<tr><td><var>61-65</var></td><td>variable highlights for ideograms.</td></tr>
</tbody></table>






<pre>Sequence     Sequence                             Parameter   or
Mnemonic     Name              Sequence           Value      Mode   terminfo
-----------------------------------------------------------------------------
APC  Applicatn Program Command \E _                -         Delim  -
BEL  Bell *                    ^G                  -         -      bel
BPH  Break Permitted Here *    \E B                -         *      -
BS   Backpace *                ^H                  -         EF     -
CAN  Cancel *                  ^X                  -         -      -   (A)
CBT  Cursor Backward Tab       \E [ Pn Z           1         eF     cbt
CCH  Cancel Previous Character \E T                -         -      -
CHA  Cursor Horizntal Absolute \E [ Pn G           1         eF     hpa (B)
CHT  Cursor Horizontal Tab     \E [ Pn I           1         eF     tab (C)
CMD  Coding Method Delimiter * \E
CNL  Cursor Next Line          \E [ Pn E           1         eF     nel (D)
CPL  Cursor Preceding Line     \E [ Pn F           1         eF     -
CPR  Cursor Position Report    \E [ Pn ; Pn R      1, 1      -      -   (E)
CSI  Control Sequence Intro    \E [                -         Intro  -
CTC  Cursor Tabulation Control \E [ Ps W           0         eF     -   (F)
CUB  Cursor Backward           \E [ Pn D           1         eF     cub
CUD  Cursor Down               \E [ Pn B           1         eF     cud
CUF  Cursor Forward            \E [ Pn C           1         eF     cuf
CUP  Cursor Position           \E [ Pn ; Pn H      1, 1      eF     cup (G)
CUU  Cursor Up                 \E [ Pn A           1         eF     cuu
CVT  Cursor Vertical Tab       \E [ Pn Y           -         eF     -   (H)
DA   Device Attributes         \E [ Pn c           0         -      -
DAQ  Define Area Qualification \E [ Ps o           0         -      -
DCH  Delete Character          \E [ Pn P           1         eF     dch
DCS  Device Control String     \E P                -         Delim  -
DL   Delete Line               \E [ Pn M           1         eF     dl
DLE  Data Link Escape *        ^P                  -         -      -
DMI  Disable Manual Input      \E \                -         Fs     -
DSR  Device Status Report      \E [ Ps n           0         -      -   (I)
DTA  Dimension Text Area *     \E [ Pn ; Pn SPC T  -         PC     -
EA   Erase in Area             \E [ Ps O           0         eF     -   (J)
ECH  Erase Character           \E [ Pn X           1         eF     ech
ED   Erase in Display          \E [ Ps J           0         eF     ed  (J)
EF   Erase in Field            \E [ Ps N           0         eF     -
EL   Erase in Line             \E [ Ps K           0         eF     el  (J)
EM   End of Medium *           ^Y                  -         -      -
EMI  Enable Manual Input       \E b                          Fs     -
ENQ  Enquire                   ^E                  -         -      -
EOT  End Of Transmission       ^D                  -         *      -
EPA  End of Protected Area     \E W                -         -      -   (K)
ESA  End of Selected Area      \E G                -         -      -
ESC  Escape                    ^[                  -         -      -
ETB  End Transmission Block    ^W                  -         -      -
ETX  End of Text               ^C                  -         -      -
FF   Form Feed                 ^L                  -         -      -
FNK  Function Key *            \E [ Pn SPC W       -         -      -
GCC  Graphic Char Combination* \E [ Pn ; Pn SPC B  -         -      -
FNT  Font Selection            \E [ Pn ; Pn SPC D  0, 0      FE     -
GSM  Graphic Size Modify       \E [ Pn ; Pn SPC B  100, 100  FE     -   (L)
GSS  Graphic Size Selection    \E [ Pn SPC C       none      FE     -
HPA  Horz Position Absolute    \E [ Pn `           1         FE     -   (B)
HPB  Char Position Backward    \E [ j              1         FE     -
HPR  Horz Position Relative    \E [ Pn a           1         FE     -   (M)
HT   Horizontal Tab *          ^I                  -         FE     -   (N)
HTJ  Horz Tab w/Justification  \E I                -         FE     -
HTS  Horizontal Tab Set        \E H                -         FE     hts
HVP  Horz &amp;amp; Vertical Position  \E [ Pn ; Pn f      1, 1      FE     -   (G)
ICH  Insert Character          \E [ Pn @           1         eF     ich
IDCS ID Device Control String  \E [ SPC O          -         *      -
IGS  ID Graphic Subrepertoire  \E [ SPC M          -         *      -
IL   Insert Line               \E [ Pn L           1         eF     il
IND  Index                     \E D                -         FE     -
INT  Interrupt                 \E a                -         Fs     -
JFY  Justify                   \E [ Ps SPC F       0         FE     -
IS1  Info Separator #1 *       ^_                  -         *      -
IS2  Info Separator #1 *       ^^                  -         *      -
IS3  Info Separator #1 *       ^]                  -         *      -
IS4  Info Separator #1 *       ^\                  -         *      -
LF   Line Feed                 ^J                  -         -      -
LS1R Locking Shift Right 1 *   \E ~                -         -      -
LS2  Locking Shift 2 *         \E n                -         -      -
LS2R Locking Shift Right 2 *   \E }                -         -      -
LS3  Locking Shift 3 *         \E o                -         -      -
LS3R Locking Shift Right 3 *   \E |                -         -      -
MC   Media Copy                \E [ Ps i           0         -      -   (S)
MW   Message Waiting           \E U                -         -      -
NAK  Negative Acknowledge *    ^U                  -         *      -
NBH  No Break Here *           \E C                -         -      -
NEL  Next Line                 \E E                -         FE     nel (D)
NP   Next Page                 \E [ Pn U           1         eF     -
NUL  Null *                    ^@                  -         -      -
OSC  Operating System Command  \E ]                -         Delim  -
PEC  Pres. Expand/Contract *   \E Pn SPC Z         0         -      -
PFS  Page Format Selection *   \E Pn SPC J         0         -      -
PLD  Partial Line Down         \E K                -         FE     -   (T)
PLU  Partial Line Up           \E L                -         FE     -   (U)
PM   Privacy Message           \E ^                -         Delim  -
PP   Preceding Page            \E [ Pn V           1         eF     -
PPA  Page Position Absolute *  \E [ Pn SPC P       1         FE     -
PPB  Page Position Backward *  \E [ Pn SPC R       1         FE     -
PPR  Page Position Forward *   \E [ Pn SPC Q       1         FE     -
PTX  Parallel Texts *          \E [ \              -         -      -
PU1  Private Use 1             \E Q                -         -      -
PU2  Private Use 2             \E R                -         -      -
QUAD Typographic Quadding      \E [ Ps SPC H       0         FE     -
REP  Repeat Char or Control    \E [ Pn b           1         -      rep
RI   Reverse Index             \E M                -         FE     -   (V)
RIS  Reset to Initial State    \E c                -         Fs     -
RM   Reset Mode *              \E [ Ps l           -         -      -   (W)
SACS Set Add. Char. Sep. *     \E [ Pn SPC /       0         -      -
SAPV Sel. Alt. Present. Var. * \E [ Ps SPC ]       0         -      -   (X)
SCI  Single-Char Introducer    \E Z                -         -      -
SCO  Sel. Char. Orientation *  \E [ Pn ; Pn SPC k  -         -      -
SCS  Set Char. Spacing *       \E [ Pn SPC g       -         -      -
SD   Scroll Down               \E [ Pn T           1         eF     rin
SDS  Start Directed String *   \E [ Pn ]           1         -      -
SEE  Select Editing Extent     \E [ Ps Q           0         -      -   (Y)
SEF  Sheet Eject &amp;amp; Feed *  \E [ Ps ; Ps SPC Y  0,0       -      -
SGR  Select Graphic Rendition  \E [ Ps m           0         FE     sgr (O)
SHS  Select Char. Spacing *    \E [ Ps SPC K       0         -      -
SI   Shift In                  ^O                  -         -      -   (P)
SIMD Sel. Imp. Move Direct. *  \E [ Ps ^           -         -      -
SL   Scroll Left               \E [ Pn SPC @       1         eF     -
SLH  Set Line Home *           \E [ Pn SPC U       -         -      -
SLL  Set Line Limit *          \E [ Pn SPC V       -         -      -
SLS  Set Line Spacing *        \E [ Pn SPC h       -         -      -
SM   Select Mode               \E [ Ps h           none      -      -   (W)
SO   Shift Out                 ^N                  -         -      -   (Q)
SOH  Start Of Heading *        ^A                  -         -      -
SOS  Start of String *         \E X                -         -      -
SPA  Start of Protected Area   \E V                -         -      -   (Z)
SPD  Select Pres. Direction *  \E [ Ps ; Ps SPC S  0,0       -      -
SPH  Set Page Home *           \E [ Ps SPC G       -         -      -
SPI  Spacing Increment         \E [ Pn ; Pn SPC G  none      FE     -
SPL  Set Page Limit *          \E [ Ps SPC j       -         -      -
SPQR Set Pr. Qual. &amp;amp; Rapid. *  \E [ Ps SPC X       0         -      -
SR   Scroll Right              \E [ Pn SPC A       1         eF     -
SRCS Set Reduced Char. Sep. *  \E [ Pn SPC f       0         -      -
SRS  Start Reversed String *   \E [ Ps [           0         -      -
SSA  Start of Selected Area    \E F                -         -      -
SSU  Select Size Unit *        \E [ Pn SPC I       0         -      -
SSW  Set Space Width *         \E [ Pn SPC [       none      -      -
SS2  Single Shift 2 (G2 set)   \E N                -         Intro  -
SS3  Single Shift 3 (G3 set)   \E O                -         Intro  -
ST   String Terminator         \E \                -         Delim  -
STAB Selective Tabulation *    \E [ Pn SPC ^       -         -      -
STS  Set Transmit State        \E S                -         -      -
STX  Start pf Text *           ^B                  -         -      -
SU   Scroll Up                 \E [ Pn S           1         eF     indn
SUB  Substitute *              ^Z                  -         -      -
SVS  Select Line Spacing *     \E [ Pn SPC \       1         -      -
SYN  Synchronous Idle *        ^F                  -         -      -
TAC  Tabul. Aligned Centered * \E [ Pn SPC b       -         -      -
TALE Tabul. Al. Leading Edge * \E [ Pn SPC a       -         -      -
TATE Tabul. Al. Trailing Edge* \E [ Pn SPC `       -         -      -
TBC  Tab Clear                 \E [ Ps g           0         FE     tbc
TCC  Tabul. Centered on Char * \E [ Pn SPC c       -         -      -
TSR  Tabulation Stop Remove  * \E [ Pn SPC d       -         FE     -
TSS  Thin Space Specification  \E [ Pn SC E        none      FE     -
VPA  Vert. Position Absolute   \E [ Pn d           1         FE     vpa
VPB  Line Position Backward *  \E [ Pn k           1         FE     -
VPR  Vert. Position Relative   \E [ Pn e           1         FE     -   (R)
VPR  Vert. Position Relative   \E [ Pn e           1         FE     -   (R)
VT   Vertical Tabulation *     ^K                  -         FE     -
VTS  Vertical Tabulation Set   \E J                -         FE     -</pre>









<h3>Basic Characteristics</h3>
<p>This section documents the capabilities that describe the basic and nature of the terminal, and also those that are relevant to the output of graphic characters.</p>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>os</td><td>Flag whose presence means that the terminal can overstrike.  This means that outputting a graphic character does not erase whatever was present in the same character position before.  The terminals that can overstrike include printing terminals, storage tubes (all obsolete nowadays), and many bit-map displays.</td></tr>
<tr><td>eo</td><td>Flag whose presence means that outputting a space erases a character position even if the terminal supports overstriking.  If this flag is not present and overstriking is supported, output of a space has no effect except to move the cursor.  (On terminals that do not support overstriking, you can always assume that outputting a space at a position erases whatever character was previously displayed there.)</td></tr>
<tr><td>gn</td><td>Flag whose presence means that this terminal type is a generic type which does not really describe any particular terminal.  Generic types are intended for use as the default type assigned when the user connects to the system, with the intention that the user should specify what type he really has.  One example of a generic type is the type <code>network</code>.  Since the generic type cannot say how to do anything interesting with the terminal, termcap-using programs will always find that the terminal is too weak to be supported if the user has failed to specify a real terminal type in place of the generic one.  The gnflag directs these programs to use a different error message: “You have not specified your real terminal type”, rather than “Your terminal is not powerful enough to be used”.</td></tr>
<tr><td>hc</td><td>Flag whose presence means this is a hardcopy terminal.</td></tr>
<tr><td>rp</td><td>String of commands to output a graphic character <var>c</var>, repeated <var>n</var> times.  The first parameter value is the ASCII code for the desired character, and the second parameter is the number of times to repeat the character.  Often this command requires padding proportional to the number of times the character is repeated.  This effect can be had by using parameter arithmetic with <code>&lt;samp&gt;%&lt;/samp&gt;</code>-sequences to compute the amount of padding, then generating the result as a number at the front of the string so that <code>tputs</code> will treat it as padding.</td></tr>
<tr><td>hz</td><td>Flag whose presence means that the ASCII character cannot be output on this terminal because it is used for display commands.  Programs handle this flag by checking all text to be output and replacing each ~with some other character(s).  If this is not done, the screen will be thoroughly garbled.  The old Hazeltine terminals that required such treatment are probably very rare today, so you might as well not bother to support this flag.</td></tr>
<tr><td>CC</td><td>String whose presence means the terminal has a settable command character.  The value of the string is the default command character (which is usually &lt;ESC&gt;).  All the strings of commands in the terminal description should be written to use the default command character.  If you are writing an application program that changes the command character, use the CCcapability to figure out how to translate all the display commands to work with the new command character.  Most programs have no reason to look at the CCcapability.</td></tr>
<tr><td>xb</td><td>Flag whose presence identifies Superbee terminals which are unable to transmit the characters &lt;ESC&gt; and <kbd>Control-C</kbd>.  Programs which support this flag are supposed to check the input for the code sequences sent by the &lt;F1&gt; and &lt;F2&gt; keys, and pretend that &lt;ESC&gt; or <kbd>Control-C</kbd> (respectively) had been read.  But this flag is obsolete, and not worth supporting.</td></tr>
</tbody></table>

<h2>7bit vs. 8bit</h2>
<p>These recommendations are optional.  IBCS2 allows the leading escape to # be either the 7-bit <code>\E[</code> or 8-bit <code>\0233</code> introducer, in accordance with # the ANSI X.364/ISO 6429/ECMA-48 standard.</p>
<blockquote><cite>1.6.1 Describing the Encoding</cite> <p>For example, the <code>cm</code> string for a standard ANSI terminal is written as <code>\E[%i%d;%dH</code>.  (<code>\E</code> stands for .)  <code>cm</code> by convention always requires two parameters, the vertical and horizontal goal positions, so this string specifies the encoding of two parameters.  Here <code>%i</code> increments the two values supplied, and each <code>%d</code> encodes one of the values in decimal.  If the cursor position values 20,58 are encoded with this string, the result is <code>\E[21;59H</code>.</p></blockquote>
<p>First, here are the <code>%</code>-sequences that generate output.  Except for <code>%%</code>, each of them encodes one parameter and advances the pointer to the following parameter.</p>
<ul>
<li><code>%%</code> Output a single <code>%</code>.  This is the only way to represent a literal <code>%</code> in a terminal command with parameters.  <code>%%</code> does not use up a parameter.</li>
<li><code>%d</code> As in <code>printf</code>, output the next parameter in decimal.</li>
<li><code>%2</code> Like <code>%02d</code> in <code>printf</code>: output the next parameter in decimal, and always use at least two digits.</li>
<li><code>%3</code> Like <code>%03d</code> in <code>printf</code>: output the next parameter in decimal, and always use at least three digits.  Note that <code>%4</code> and so on are _not_ defined.</li>
<li><code>%.</code> Output the next parameter as a single character whose ASCII code is the parameter value.  Like <code>%c</code> in <code>printf</code>.</li>
<li><code>%+CHAR</code> Add the next parameter to the character CHAR, and output the resulting character.  For example, <code>%+ </code> represents 0 as a space, 1 as <code>!</code>, etc.</li>
</ul>

<p>The following <code>%</code>-sequences specify alteration of the parameters (their values, or their order) rather than encoding a parameter for output.  They generate no output; they are used only for their side effects on the parameters.  Also, they do not advance the "next parameter" pointer except as explicitly stated.  Only <code>%i</code>, <code>%r</code> and <code>%&gt;</code> are defined in standard Unix termcap.  The others are GNU extensions.</p>
<ul>
<li><code>%i</code> Increment the next two parameters.  This is used for terminals that expect cursor positions in origin 1.  For example, <code>%i%d,%d</code> would output two parameters with <code>1</code> for 0, <code>2</code> for 1, etc.</li>
<li><code>%r</code> Interchange the next two parameters.  This is used for terminals whose cursor positioning command expects the horizontal position first.</li>
<li><code>%s</code> Skip the next parameter.  Do not output anything.</li>
<li><code>%b</code> Back up one parameter.  The last parameter used will become once again the next parameter to be output, and the next output command will use it.  Using <code>%b</code> more than once, you can back up any number of parameters, and you can refer to each parameter any number of times.</li>
<li><code>%&gt;C1C2</code> Conditionally increment the next parameter.  Here C1 and C2 are characters which stand for their ASCII codes as numbers.  If the next parameter is greater than the ASCII code of C1, the ASCII code of C2 is added to it.</li>
<li><code>%a OP TYPE POS</code> Perform arithmetic on the next parameter, do not use it up, and do not output anything.  Here OP specifies the arithmetic operation, while TYPE and POS together specify the other operand.</li>
</ul>


<p>Spaces are used above to separate the operands for clarity; the spaces don't appear in the data base, where this sequence is exactly five characters long.  The character OP says what kind of arithmetic operation to perform.  It can be any of these characters:</p>
<ul>
<li><var>=</var> - assign a value to the next parameter, ignoring its old value.   The new value comes from the other operand.</li>
<li><var>+</var> - add the other operand to the next parameter.</li>
<li><var>-</var> - subtract the other operand from the next parameter.</li>
<li><var>*</var> - multiply the next parameter by the other operand.</li>
<li><var>/</var> - divide the next parameter by the other operand.</li>
</ul>

<p>The "other operand" may be another parameter's value or a constant; the character TYPE says which.  It can be:</p>
<ul>
<li><var>p</var> - Use another parameter.  The character POS says which   parameter to use.  Subtract 64 from its ASCII code to get the   position of the desired parameter relative to this one.  Thus,   the character <code>A</code> as POS means the parameter after the next   one; the character <code>?</code> means the parameter before the next   one.</li>
<li><var>c</var> - Use a constant value.  The character POS specifies the value   of the constant.  The 0200 bit is cleared out, so that 0200   can be used to represent zero.</li>
</ul>

<p>The following <code>%</code>-sequences are special purpose hacks to compensate for the weird designs of obscure terminals.  They modify the next parameter or the next two parameters but do not generate output and do not use up any parameters.  <code>%m</code> is a GNU extension; the others are defined in standard Unix termcap.</p>
<ul>
<li><var>%n</var> - Exclusive-or the next parameter with 0140, and likewise the parameter after next.</li>
<li><var>%m</var> - Complement all the bits of the next parameter and the parameter after next.</li>
<li><var>%B</var> - Encode the next parameter in BCD.  It alters the value of the parameter by adding six times the quotient of the parameter by ten. Here is a C statement that shows how the new value is computed:  <code>PARM = (PARM / 10) * 16 + PARM % 10;</code></li>
<li><var>%D</var> - Transform the next parameter as needed by Delta Data terminals. This involves subtracting twice the remainder of the parameter by 16.  <code>PARM -= 2 * (PARM % 16);</code></li>
</ul>

<h2>Terminal Type Name Conventions</h2>
<p>Here is a list of standard suffixes and their conventional meanings:</p>
<ul>
<li><var>-w</var> - Short for "wide".  This is a mode that gives the terminal more columns than usual.  This is normally a user option.</li>
<li><var>-am</var> - "Automatic margins".  This is an alternate description for use when the terminal's margin-wrap switch is on; it contains the <code>am</code> flag.  The implication is that normally the switch is off and the usual description for the terminal says that the switch is off.</li>
<li><var>-nam</var> - "No automatic margins".  The opposite of <code>-am</code>, this names an alternative description which lacks the <code>am</code> flag.  This implies that the terminal is normally operated with the margin-wrap switch turned on, and the normal description of the terminal says so.</li>
<li><var>-na</var> - "No arrows".  This terminal description initializes the terminal to keep its arrow keys in local mode.  This is a user option.</li>
<li><var>-rv</var> - "Reverse video".  This terminal description causes text output for normal video to appear as reverse, and text output for reverse video to come out as normal.  Often this description differs from the usual one by interchanging the two strings which turn reverse video on and off.</li>
</ul>

<p>This is a user option; you can choose either the "reverse video" variant terminal type or the normal terminal type, and termcap will obey.</p>
<ul>
<li><var>-s</var> - "Status".  Says to enable use of a status line which ordinary output does not touch (*note Status Line::).</li>
</ul>

<p>Some terminals have a special line that is used only as a status line.  For these terminals, there is no need for an <code>-s</code> variant; the status line commands should be defined by default.  On other terminals, enabling a status line means removing one screen line from ordinary use and reducing the effective screen height.  For these terminals, the user can choose the <code>-s</code> variant type to request use of a status line.</p>
<ul>
<li><var>-NLINES</var> - Says to operate with NLINES lines on the screen, for terminals such as the Ambassador which provide this as an option.  Normally this is a user option; by choosing the terminal type, you control how many lines termcap will use.</li>
<li><var>-NPAGESp</var> - Says that the terminal has NPAGES pages worth of screen memory, for terminals where this is a hardware option.</li>
<li><var>-unk</var> - Says that description is not for direct use, but only for reference in <code>tc</code> capabilities.  Such a description is a kind of subroutine, because it describes the common characteristics of several variant descriptions that would use other suffixes in place of <code>-unk</code>.</li>
</ul>

<h2>MS-DOS ANSI.SYS</h2>
<p>Here is a description of the color and attribute controls supported in the ANSI.SYS driver under MS-DOS.  Most console drivers and ANSI terminal emulators for Intel boxes obey these.  They are a proper subset of the ECMA-48 escapes.</p>
<p>Bright black becomes gray, bright brown becomes yellow. These coincide with the prescriptions of the ISO 6429/ECMA-48 standard.  * If the 5 attribute is on and you set a background color (40-47) it is supposed to enable bright background.</p>
<pre>0        all attributes off
1        foreground bright
4        underscore on
5        blink on/background bright (not reliable with brown)
7        reverse-video
8        set blank (non-display)
10       set primary font
11       set first alternate font (on PCs, display ROM characters 1-31)
12       set second alternate font (on PCs, display IBM high-half chars)
3n       set foreground color       / 0=black, 1=red,     2=green, 3=brown,
4n       set background color       \ 4=blue,  5=magenta, 6=cyan,  7=white</pre>

<h2>STTY</h2>
<h3>Stty Control Settings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>parenb</td><td><code>parenb</code> Generate parity bit in output and expect parity bit in input.  May be negated.</td></tr>
<tr><td>parodd</td><td>Set odd parity (even if negated).  May be negated.</td></tr>
<tr><td>cs5, cs6, cs7, cs8</td><td>Set character size to 5, 6, 7, or 8 bits.</td></tr>
<tr><td>hup, hupcl</td><td>Send a hangup signal when the last process closes the tty.  May be negated.</td></tr>
<tr><td>cstopb</td><td>Use two stop bits per character (one if negated).  May be negated.</td></tr>
<tr><td>cread</td><td>Allow input to be received.  May be negated.</td></tr>
<tr><td>clocal</td><td>Disable modem control signals.  May be negated.</td></tr>
<tr><td>crtscts</td><td>Enable RTS/CTS flow control. Disables DTR/DSR flow control. Non-POSIX.  May be negated.</td></tr>
<tr><td>cdtrdsr</td><td>Enable DTR/DSR flow control. Disables RTS/CTS flow control. Non-POSIX.  May be negated.  No stty-readable form available.  It needs to be supported by device.  Usage on device without DTR/DSR support could lead to an error and failure of <code>stty</code>.</td></tr>
</tbody></table><h3>Stty Input settings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>ignbrk</td><td>Ignore break characters.  May be negated.</td></tr>
<tr><td>brkint</td><td>Make breaks cause an interrupt signal.  May be negated.</td></tr>
<tr><td>ignpar</td><td>Ignore characters with parity errors.  May be negated.</td></tr>
<tr><td>parmrk</td><td>Mark parity errors (with a 255-0-character sequence).  May be negated.</td></tr>
<tr><td>inpck</td><td>Enable input parity checking.  May be negated.</td></tr>
<tr><td>istrip</td><td>Clear high (8th) bit of input characters.  May be negated.</td></tr>
<tr><td>inlcr</td><td>Translate newline to carriage return.  May be negated.</td></tr>
<tr><td>igncr</td><td>Ignore carriage return.  May be negated.</td></tr>
<tr><td>icrnl</td><td>Translate carriage return to newline.  May be negated.</td></tr>
<tr><td>iutf8</td><td>Assume input characters are UTF-8 encoded.  May be negated.</td></tr>
<tr><td>ixon</td><td>Enable XON/XOFF flow control (that is, <code>CTRL-S</code>/<code>CTRL-Q</code>).  May be negated.</td></tr>
<tr><td>ixoff, tandem</td><td>Enable sending of <code>stop</code> character when the system input buffer is almost full, and <code>start</code> character when it becomes almost empty again.  May be negated.</td></tr>
<tr><td>iuclc</td><td>Translate uppercase characters to lowercase.  Non-POSIX.  May be negated.</td></tr>
<tr><td>ixany</td><td>Allow any character to restart output (only the start character if negated).  Non-POSIX.  May be negated.</td></tr>
<tr><td>imaxbel</td><td>Enable beeping and not flushing input buffer if a character arrives when the input buffer is full.  Non-POSIX.  May be negated.</td></tr>
</tbody></table>
<h3>Stty Output settings</h3>
<p>These arguments specify output-related operations.</p>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>opost</td><td>Postprocess output.  May be negated.</td></tr>
<tr><td>olcuc</td><td>Translate lowercase characters to uppercase.  Non-POSIX.  May be negated.</td></tr>
<tr><td>ocrnl</td><td>Translate carriage return to newline.  Non-POSIX.  May be negated.</td></tr>
<tr><td>onlcr</td><td>Translate newline to carriage return-newline.  Non-POSIX.  May be negated.</td></tr>
<tr><td>onocr</td><td>Do not print carriage returns in the first column.  Non-POSIX. May be negated.</td></tr>
<tr><td>onlret</td><td>Newline performs a carriage return.  Non-POSIX.  May be negated.</td></tr>
<tr><td>ofill</td><td>Use fill (padding) characters instead of timing for delays. Non-POSIX.  May be negated.</td></tr>
<tr><td>ofdel</td><td>Use delete characters for fill instead of null characters. Non-POSIX.  May be negated.</td></tr>
<tr><td>nl1, nl0</td><td>Newline delay style.  Non-POSIX.</td></tr>
<tr><td>cr3, cr2, cr1, cr0</td><td>Carriage return delay style.  Non-POSIX.</td></tr>
<tr><td>tab3, tab2, tab1, tab0</td><td>Horizontal tab delay style.  Non-POSIX.</td></tr>
<tr><td>bs1, bs0</td><td>Backspace delay style.  Non-POSIX.</td></tr>
<tr><td>vt1, vt0</td><td>Vertical tab delay style.  Non-POSIX.</td></tr>
<tr><td>ff1, ff0</td><td>Form feed delay style.  Non-POSIX.</td></tr>
</tbody></table>
<h3>Stty Local settings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>isig</td><td>Enable <code>interrupt</code>, <code>quit</code>, and <code>suspend</code> special characters.  May be negated.</td></tr>
<tr><td>icanon</td><td>Enable <code>erase</code>, <code>kill</code>, <code>werase</code>, and <code>rprnt</code> special characters. May be negated.</td></tr>
<tr><td>iexten</td><td>Enable non-POSIX special characters.  May be negated.</td></tr>
<tr><td>echo</td><td>Echo input characters.  May be negated.</td></tr>
<tr><td>echoe, crterase</td><td>Echo <code>erase</code> characters as backspace-space-backspace.  May be negated.</td></tr>
<tr><td>echok</td><td>Echo a newline after a <code>kill</code> character.  May be negated.</td></tr>
<tr><td>echonl</td><td>Echo newline even if not echoing other characters.  May be negated.</td></tr>
<tr><td>noflsh</td><td>Disable flushing after <code>interrupt</code> and <code>quit</code> special characters. May be negated.</td></tr>
<tr><td>xcase</td><td>Enable input and output of uppercase characters by preceding their lowercase equivalents with <code>\</code>, when <code>icanon</code> is set.  Non-POSIX. May be negated.</td></tr>
<tr><td>tostop</td><td>Stop background jobs that try to write to the terminal.  Non-POSIX. May be negated.</td></tr>
<tr><td>echoprt, prterase</td><td>Echo erased characters backward, between <code>\</code> and <code>/</code>.  Non-POSIX. May be negated.</td></tr>
<tr><td>echoctl, ctlecho</td><td>Echo control characters in hat notation (<code>^C</code>) instead of literally.  Non-POSIX.  May be negated.</td></tr>
<tr><td>echoke, crtkill</td><td>Echo the <code>kill</code> special character by erasing each character on the line as indicated by the <code>echoprt</code> and <code>echoe</code> settings, instead of by the <code>echoctl</code> and <code>echok</code> settings.  Non-POSIX.  May be negated.</td></tr>
</tbody></table>
<h3>Stty Combination settings</h3>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td>evenp, parity</td><td>Same as <code>parenb -parodd cs7</code>.  May be negated.  If negated, same as <code>-parenb cs8</code>.</td></tr>
<tr><td>oddp</td><td>Same as <code>parenb parodd cs7</code>.  May be negated.  If negated, same as <code>-parenb cs8</code>.</td></tr>
<tr><td>nl</td><td>Same as <code>-icrnl -onlcr</code>.  May be negated.  If negated, same as <code>icrnl -inlcr -igncr onlcr -ocrnl -onlret</code>.</td></tr>
<tr><td>ek</td><td>Reset the <code>erase</code> and <code>kill</code> special characters to their default values.</td></tr>
<tr><td>sane</td><td>Sets all special characters to their default values and: <pre>cread -ignbrk brkint -inlcr -igncr icrnl -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke</pre></td></tr>
<tr><td>cooked</td><td>Same as <code>brkint ignpar istrip icrnl ixon opost isig icanon</code>, plus sets the <code>eof</code> and <code>eol</code> characters to their default values if they are the same as the <code>min</code> and <code>time</code> characters.  May be negated.  If negated, same as <code>raw</code>.</td></tr>
<tr><td>raw</td><td>Same as: <pre>-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -isig -icanon -xcase min 1 time 0</pre> May be negated.  If negated, same as <code>cooked</code>.</td></tr>
<tr><td>cbreak</td><td>Same as <code>-icanon</code>.  May be negated.  If negated, same as <code>icanon</code>.</td></tr>
<tr><td>pass8</td><td>Same as <code>-parenb -istrip cs8</code>.  May be negated.  If negated, same as <code>parenb istrip cs7</code>.</td></tr>
<tr><td>litout</td><td>Same as <code>-parenb -istrip -opost cs8</code>.  May be negated.  If negated, same as <code>parenb istrip opost cs7</code>.</td></tr>
<tr><td>decctlq</td><td>Same as <code>-ixany</code>.  Non-POSIX.  May be negated.</td></tr>
<tr><td>tabs</td><td>Same as <code>tab0</code>.  Non-POSIX.  May be negated.  If negated, same as <code>tab3</code>.</td></tr>
<tr><td>lcase, LCASE</td><td>Same as <code>xcase iuclc olcuc</code>.  Non-POSIX.  May be negated.</td></tr>
<tr><td>crt</td><td>Same as <code>echoe echoctl echoke</code>.</td></tr>
<tr><td>dec</td><td>Same as <code>echoe echoctl echoke -ixany intr ^C erase ^? kill C-u</code>.</td></tr>
</tbody></table>

<h3>Special characters</h3>
<p>The special characters' default values vary from system to system. They are set with the syntax <code>name value</code>, where the names are listed below and the value can be given either literally, in hat notation (<code>^C</code>), or as an integer which may start with <code>0x</code> to indicate hexadecimal, <code>0</code> to indicate octal, or any other digit to indicate decimal.</p>
<p>For GNU stty, giving a value of <code>^-</code> or <code>undef</code> disables that special character.  (This is incompatible with Ultrix <code>stty</code>, which uses  a value of <code>u</code> to disable a special character.  GNU <code>stty</code> treats a value <code>u</code> like any other, namely to set that special character to .)</p>
<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><var>intr</var></td><td>Send an interrupt signal.</td></tr>
<tr><td><var>quit</var></td><td>Send a quit signal.</td></tr>
<tr><td><var>erase</var></td><td>Erase the last character typed.</td></tr>
<tr><td><var>kill</var></td><td>Erase the current line.</td></tr>
<tr><td><var>eof</var></td><td>Send an end of file (terminate the input).</td></tr>
<tr><td><var>eol</var></td><td>End the line.</td></tr>
<tr><td><var>eol2</var></td><td>Alternate character to end the line.  Non-POSIX.</td></tr>
<tr><td><var>swtch</var></td><td>Switch to a different shell layer.  Non-POSIX.</td></tr>
<tr><td><var>start</var></td><td>Restart the output after stopping it.</td></tr>
<tr><td><var>stop</var></td><td>Stop the output.</td></tr>
<tr><td><var>susp</var></td><td>Send a terminal stop signal.</td></tr>
<tr><td><var>dsusp</var></td><td>Send a terminal stop signal after flushing the input.  Non-POSIX.</td></tr>
<tr><td><var>rprnt</var></td><td>Redraw the current line.  Non-POSIX.</td></tr>
<tr><td><var>werase</var></td><td>Erase the last word typed.  Non-POSIX.</td></tr>
<tr><td><var>lnext</var></td><td>Enter the next character typed literally, even if it is a special character.  Non-POSIX.</td></tr>
</tbody></table>


<h3>Special settings</h3>
<ul>
<li><var>min N</var> - Set the minimum number of characters that will satisfy a read until the time value has expired, when <code>-icanon</code> is set.</li>
<li><var>time N</var> - Set the number of tenths of a second before reads time out if the minimum number of characters have not been read, when <code>-icanon</code> is set.</li>
<li><var>ispeed N</var> - Set the input speed to N.</li>
<li><var>ospeed N</var> - Set the output speed to N.</li>
<li><var>rows N</var> - Tell the tty kernel driver that the terminal has N rows. Non-POSIX.</li>
<li><var>cols N</var>, <var>columns N</var> - Tell the kernel that the terminal has N columns.  Non-POSIX.</li>
<li><var>size</var> - Print the number of rows and columns that the kernel thinks the terminal has.  (Systems that don't support rows and columns in the kernel typically use the environment variables <code>LINES</code> and <code>COLUMNS</code> instead; however, GNU <code>stty</code> does not know anything about them.)  Non-POSIX.</li>
<li><var>line N</var> - Use line discipline N.  Non-POSIX.</li>
<li><var>speed</var> - Print the terminal speed.</li>
<li><var>N</var> - Set the input and output speeds to N.  N can be one of: 0 50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 <code>exta</code> <code>extb</code>.  <code>exta</code> is the same as 19200; <code>extb</code> is the same as 38400.  0 hangs up the line if <code>-clocal</code> is set.</li>
</ul>


<h2>Color Terminals</h2>
<pre>color256 ()
{
    local L=$(sed &#039;s/[0-9]//g; s/./#/g&#039; &lt;&lt;&lt;`seq -s+0 $(($COLUMNS - 10))`);
    for i in `seq 0 $(tput colors)`;
    do printf " %.3d `tput setab $i`${L}${R} %.3d `tput setab 0;tput setaf 7`\n" $i $i | tr &#039;#&#039; &#039; &#039;;
    done
}</pre>

<pre>for F in `find ~/.terminfo/ -type f | sed &#039;s/^.*\///&#039; | xargs -P0 -I&#039;TT&#039; sh -c &#039;echo "$(tput -T TT colors): TT"&#039;|sed &#039;/^-/d&#039;| grep ^16:|cut -d: -f2`; do
echo -e "\n\n";
pm $F; export TERM=$F; tput -T $F initc; color256; done</pre>

<pre>find ~/.terminfo/ -type f | sed &#039;s/^.*\///&#039; | xargs -I&#039;TT&#039; sh -c &#039;echo "$(tput -T TT colors): TT"&#039;|sed &#039;/^-/d&#039;</pre>

<h3>Terminals with 16 Colors</h3>
<ul>
<li><var>aixterm-16color</var></li>
<li><var>amiga-vnc</var></li>
<li><var>hp2397</var></li>
<li><var>hp2397a</var></li>
<li><var>hp+color</var></li>
<li><var>ibm+16color</var></li>
<li><var>konsole-16color</var></li>
<li><var>nsterm-16color</var></li>
<li><var>nsterm-7-c</var></li>
<li><var>nsterm-7-c-s</var></li>
<li><var>nsterm-acs-c</var></li>
<li><var>nsterm-acs-c-s</var></li>
<li><var>nsterm-c</var></li>
<li><var>nsterm+c</var></li>
<li><var>nsterm-c-7</var></li>
<li><var>nsterm-c-acs</var></li>
<li><var>nsterm-c-s</var></li>
<li><var>nsterm-c-s-7</var></li>
<li><var>nsterm-c-s-acs</var></li>
<li><var>rxvt-16color</var></li>
<li><var>screen-16color</var></li>
<li><var>screen-16color-bce</var></li>
<li><var>screen-16color-bce-s</var></li>
<li><var>screen-16color-s</var></li>
<li><var>xterm-16color</var></li>
</ul>

<h3>Terminals with 52 Colors</h3>
<ul>
<li><var>d430c-dg-ccc</var></li>
<li><var>d430c-unix-25-ccc</var></li>
<li><var>d430c-unix-ccc</var></li>
<li><var>d430c-unix-s-ccc</var></li>
<li><var>d430c-unix-sr-ccc</var></li>
<li><var>d430c-unix-w-ccc</var></li>
<li><var>d430-dg-ccc</var></li>
<li><var>d430-unix-25-ccc</var></li>
<li><var>d430-unix-ccc</var></li>
<li><var>d430-unix-s-ccc</var></li>
<li><var>d430-unix-sr-ccc</var></li>
<li><var>d430-unix-w-ccc</var></li>
<li><var>dg+ccc</var></li>
<li><var>dgunix+ccc</var></li>
</ul>

<h3>Terminals with 64 Colors</h3>
<ul>
<li><var>hpterm-color</var></li>
<li><var>wy370</var></li>
<li><var>wy370-101k</var></li>
<li><var>wy370-105k</var></li>
<li><var>wy370-EPC</var></li>
<li><var>wy370-nk</var></li>
<li><var>wy370-rv</var></li>
<li><var>wy370-vb</var></li>
<li><var>wy370-w</var></li>
<li><var>wy370-wvb</var></li>
<li><var>wyse370</var></li>
<li><var>Eterm-88color</var></li>
<li><var>rxvt-88color</var></li>
<li><var>xterm-88color</var></li>
<li><var>xterm+88color</var></li>
</ul>

<h3>Terminals with 256 colors</h3>
<ul>
<li><var>Eterm-256color</var></li>
<li><var>gnome-256color</var></li>
<li><var>konsole-256color</var></li>
<li><var>putty-256color</var></li>
<li><var>rxvt-256color</var></li>
<li><var>screen-256color</var></li>
<li><var>screen-256color-bce</var></li>
<li><var>screen-256color-bce-s</var></li>
<li><var>screen-256color-s</var></li>
<li><var>xterm-256color</var></li>
<li><var>xterm+256color</var></li>
</ul>


<h3>View All tput capabilities</h3>
<p><a href="http://blogs.msdn.com/adioltean/articles/271063.aspx">http://blogs.msdn.com/adioltean/articles/271063.aspx</a></p>
<pre>function tputs(){ infocmp -1|sed &#039;s/^[   ]*//; /=/!d; s/=.*//g; /[#\|]/d&#039;; }</pre>

<p>Some  common  terminfo  parameter sequences, their termcap equivalents, and some terminal types which commonly have such sequences, are:</p>
<pre>terminfo                    termcap   Representative Terminals
---------------------------------------------------------------
%p1%c                       %.        adm
%p1%d                       %d        hp, ANSI standard, vt100
%p1%+%c                 %+x       concept
%i                          %iq       ANSI standard, vt100
%p1%?%&gt;%t%p1%+%;    %&gt;xy      concept
%p2 is printed before %p1   %r        hp</pre>



<h2>Installing your Own Terminfo</h2>
<p><a href="http://nion.modprobe.de/mostlike.txt">MostLike</a>, or if that is offline I uploaded a copy: <a href="http://uploads.askapache.com/2010/03/mostlike.txt">mostlike - manpages with color looking like most</a></p>
<pre>rm -rvf ~/.terminfo
mkdir -pv ~/.terminfo
curl -o terminfo.master http://nion.modprobe.de/mostlike.txt; curl -Ss ftp://invisible-island.net/ncurses/terminfo.src.gz
export TERMINFO=~/.terminfo;
sudo tic -e screen-256color,screen-256color-s,screen-256color-bce,screen-256color-bce-s,xterm+256color,xterm,xterm-pcolor terminfo.src</pre>


<h2>256 Colors in Terminal</h2>
<h3>256 Colors (Background)</h3>
<pre>W=`tput setaf 7` RC="\E[0;0;0m" L=$(sed &#039;s/[0-9]//g; s/./ /g&#039; &lt;&lt;&lt;`seq -s+0 $(($COLUMNS/2))`);
&nbsp;
for i in `seq 0 256`;
do
  printf "${W}\n%.3d `tput setab $i`${L}${RC}" $i;
done</pre>



<h3>256 Colors (Foreground)</h3>
<pre>W=`tput setaf 7` WB=`tput setab 0` RC="\E[0;0;0m" L=$(sed &#039;s/[0-9]//g; s/./#/g&#039; &lt;&lt;&lt;`seq -s+0 $(($COLUMNS/2))`);
for i in `seq 0 256`;
do
  printf "${WB}\n%.3d `tput setaf $i`${L}${RC}" $i;
done</pre>



<h2>Terminal Capabilities - Infocmp</h2>
<pre>infocmp -1Lq|grep -v "$TERM\|#"|tr -d &#039;  &#039;</pre>

<h3>DEC/ANSI special sequences</h3>
<p>List of the DEC/ANSI special sequences recognized:</p>
<table class="bordered">
<tbody>
<tr class="header">
<th>Action</th>
<th>Meaning</th>
</tr>
<tr><td><code>%%</code></td>
        <td>The percent sign</td></tr>
<tr class="odd"><td><code>%t</code></td>
        <td>The time the request was received in Universal Coordinated Time
        since the epoch (Jan. 1, 1970) measured in microseconds. The value
        is preceded by <code>t=</code>.</td></tr>
<tr><td><code>%D</code></td>
        <td>The time from when the request was received to the time the
        headers are sent on the wire. This is a measure of the duration
        of the request. The value is preceded by <code>D=</code>.
        The value is measured in microseconds.</td></tr>
<tr class="odd"><td><code>%{VARNAME}e</code></td>
        <td>The contents of the <a href="../env.html">environment
        variable</a> <code>VARNAME</code>.</td></tr>
<tr><td><code>%{VARNAME}s</code></td>
        <td>The contents of the <a href="mod_ssl.html#envvars">SSL environment
        variable</a> <code>VARNAME</code>, if <code>&lt;a href="../mod/mod_ssl.html"&gt;mod_ssl&lt;/a&gt;</code> is enabled.</td></tr>

-----------------------------------------
<tr><td><code>RIS         </code></td><td>full reset</td></tr>
<tr><td><code>SC          </code></td><td>save cursor</td></tr>
<tr><td><code>RC          </code></td><td>restore cursor</td></tr>
<tr><td><code>LL          </code></td><td>home-down</td></tr>
<tr><td><code>RSR         </code></td><td>reset scroll region</td></tr>
-----------------------------------------
<tr><td><code>DECSTR      </code></td><td>soft reset (VT320)</td></tr>
<tr><td><code>S7C1T       </code></td><td>7-bit controls (VT220)</td></tr>
-----------------------------------------
<tr><td><code>ISO DEC G0  </code></td><td>enable DEC graphics for G0</td></tr>
<tr><td><code>ISO UK G0   </code></td><td>enable UK chars for G0</td></tr>
<tr><td><code>ISO US G0   </code></td><td>enable US chars for G0</td></tr>
<tr><td><code>ISO DEC G1  </code></td><td>enable DEC graphics for G1</td></tr>
<tr><td><code>ISO UK G1   </code></td><td>enable UK chars for G1</td></tr>
<tr><td><code>ISO US G1   </code></td><td>enable US chars for G1</td></tr>
-----------------------------------------
<tr><td><code>DECPAM      </code></td><td>application keypad mode</td></tr>
<tr><td><code>DECPNM      </code></td><td>normal keypad mode</td></tr>
<tr><td><code>DECANSI     </code></td><td>enter ANSI mode</td></tr>
-----------------------------------------
<tr><td><code>ECMA[+-]AM  </code></td><td>keyboard action mode</td></tr>
<tr><td><code>ECMA[+-]IRM </code></td><td>insert replace mode</td></tr>
<tr><td><code>ECMA[+-]SRM </code></td><td>send receive mode</td></tr>
<tr><td><code>ECMA[+-]LNM </code></td><td>linefeed mode</td></tr>
-----------------------------------------
<tr><td><code>DEC[+-]CKM  </code></td><td>application cursor keys</td></tr>
<tr><td><code>DEC[+-]ANM  </code></td><td>set VT52 mode</td></tr>
<tr><td><code>DEC[+-]COLM </code></td><td>132-column mode</td></tr>
<tr><td><code>DEC[+-]SCLM </code></td><td>smooth scroll</td></tr>
<tr><td><code>DEC[+-]SCNM </code></td><td>reverse video mode</td></tr>
<tr><td><code>DEC[+-]OM   </code></td><td>origin mode</td></tr>
<tr><td><code>DEC[+-]AWM  </code></td><td>wraparound mode</td></tr>
<tr><td><code>DEC[+-]ARM  </code></td><td>auto-repeat mode</td></tr>
</tbody>
</table>




<table class="bordered"><tbody><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><a id="acs_chars">acs_chars</a></td><td><code>``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,</code></td></tr>
<tr><td><a id="back_tab">back_tab</a></td><td><code>\E[Z,</code></td></tr>
<tr><td><a id="bell">bell</a></td><td><code>^G,</code></td></tr>
<tr><td><a id="carriage_return">carriage_return</a></td><td><code>^M,</code></td></tr>
<tr><td><a id="change_scroll_region">change_scroll_region</a></td><td><code>\E[%i%p1%d;%p2%dr,</code></td></tr>
<tr><td><a id="clear_all_tabs">clear_all_tabs</a></td><td><code>\E[3g,</code></td></tr>
<tr><td><a id="clear_screen">clear_screen</a></td><td><code>\E[H\E[2J,</code></td></tr>
<tr><td><a id="clr_bol">clr_bol</a></td><td><code>\E[1K,</code></td></tr>
<tr><td><a id="clr_eol">clr_eol</a></td><td><code>\E[K,</code></td></tr>
<tr><td><a id="clr_eos">clr_eos</a></td><td><code>\E[J,</code></td></tr>
<tr><td><a id="column_address">column_address</a></td><td><code>\E[%i%p1%dG,</code></td></tr>
<tr><td><a id="cursor_address">cursor_address</a></td><td><code>\E[%i%p1%d;%p2%dH,</code></td></tr>
<tr><td><a id="cursor_down">cursor_down</a></td><td><code>^J,</code></td></tr>
<tr><td><a id="cursor_home">cursor_home</a></td><td><code>\E[H,</code></td></tr>
<tr><td><a id="cursor_invisible">cursor_invisible</a></td><td><code>\E[?25l,</code></td></tr>
<tr><td><a id="cursor_left">cursor_left</a></td><td><code>^H,</code></td></tr>
<tr><td><a id="cursor_normal">cursor_normal</a></td><td><code>\E[?12l\E[?25h,</code></td></tr>
<tr><td><a id="cursor_right">cursor_right</a></td><td><code>\E[C,</code></td></tr>
<tr><td><a id="cursor_up">cursor_up</a></td><td><code>\E[A,</code></td></tr>
<tr><td><a id="cursor_visible">cursor_visible</a></td><td><code>\E[?12;25h,</code></td></tr>
<tr><td><a id="delete_character">delete_character</a></td><td><code>\E[P,</code></td></tr>
<tr><td><a id="delete_line">delete_line</a></td><td><code>\E[M,</code></td></tr>
<tr><td><a id="enter_alt_charset_mode">enter_alt_charset_mode</a></td><td><code>\E(0,</code></td></tr>
<tr><td><a id="enter_am_mode">enter_am_mode</a></td><td><code>\E[?7h,</code></td></tr>
<tr><td><a id="enter_blink_mode">enter_blink_mode</a></td><td><code>\E[5m,</code></td></tr>
<tr><td><a id="enter_bold_mode">enter_bold_mode</a></td><td><code>\E[1m,</code></td></tr>
<tr><td><a id="enter_ca_mode">enter_ca_mode</a></td><td><code>\E[?1049h,</code></td></tr>
<tr><td><a id="enter_insert_mode">enter_insert_mode</a></td><td><code>\E[4h,</code></td></tr>
<tr><td><a id="enter_reverse_mode">enter_reverse_mode</a></td><td><code>\E[7m,</code></td></tr>
<tr><td><a id="enter_secure_mode">enter_secure_mode</a></td><td><code>\E[8m,</code></td></tr>
<tr><td><a id="enter_standout_mode">enter_standout_mode</a></td><td><code>\E[7m,</code></td></tr>
<tr><td><a id="enter_underline_mode">enter_underline_mode</a></td><td><code>\E[4m,</code></td></tr>
<tr><td><a id="erase_chars">erase_chars</a></td><td><code>\E[%p1%dX,</code></td></tr>
<tr><td><a id="exit_alt_charset_mode">exit_alt_charset_mode</a></td><td><code>\E(B,</code></td></tr>
<tr><td><a id="exit_am_mode">exit_am_mode</a></td><td><code>\E[?7l,</code></td></tr>
<tr><td><a id="exit_attribute_mode">exit_attribute_mode</a></td><td><code>\E(B\E[m,</code></td></tr>
<tr><td><a id="exit_ca_mode">exit_ca_mode</a></td><td><code>\E[?1049l,</code></td></tr>
<tr><td><a id="exit_insert_mode">exit_insert_mode</a></td><td><code>\E[4l,</code></td></tr>
<tr><td><a id="exit_standout_mode">exit_standout_mode</a></td><td><code>\E[27m,</code></td></tr>
<tr><td><a id="exit_underline_mode">exit_underline_mode</a></td><td><code>\E[24m,</code></td></tr>
<tr><td><a id="flash_screen">flash_screen</a></td><td><code>\E[?5h$&lt;100/&gt;\E[?5l,</code></td></tr>
<tr><td><a id="init_2string">init_2string</a></td><td><code>\E[\041p\E[?3;4l\E[4l\E&gt;,</code></td></tr>
<tr><td><a id="initialize_color">initialize_color</a></td><td><code>\E]4;%p1%d;rgb\072%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\,</code></td></tr>
<tr><td><a id="insert_line">insert_line</a></td><td><code>\E[L,</code></td></tr>
<tr><td><a id="key_b2">key_b2</a></td><td><code>\EOE,</code></td></tr>
<tr><td><a id="key_backspace">key_backspace</a></td><td><code>\177,</code></td></tr>
<tr><td><a id="key_btab">key_btab</a></td><td><code>\E[Z,</code></td></tr>
<tr><td><a id="key_dc">key_dc</a></td><td><code>\E[3~,</code></td></tr>
<tr><td><a id="key_down">key_down</a></td><td><code>\EOB,</code></td></tr>
<tr><td><a id="key_end">key_end</a></td><td><code>\EOF,</code></td></tr>
<tr><td><a id="key_enter">key_enter</a></td><td><code>\EOM,</code></td></tr>
<tr><td><a id="key_f1">key_f1</a></td><td><code>\EOP,</code></td></tr>
<tr><td><a id="key_f10">key_f10</a></td><td><code>\E[21~,</code></td></tr>
<tr><td><a id="key_f11">key_f11</a></td><td><code>\E[23~,</code></td></tr>
<tr><td><a id="key_f12">key_f12</a></td><td><code>\E[24~,</code></td></tr>
<tr><td><a id="key_f13">key_f13</a></td><td><code>\EO2P,</code></td></tr>
<tr><td><a id="key_f14">key_f14</a></td><td><code>\EO2Q,</code></td></tr>
<tr><td><a id="key_f15">key_f15</a></td><td><code>\EO2R,</code></td></tr>
<tr><td><a id="key_f16">key_f16</a></td><td><code>\EO2S,</code></td></tr>
<tr><td><a id="key_f17">key_f17</a></td><td><code>\E[15;2~,</code></td></tr>
<tr><td><a id="key_f18">key_f18</a></td><td><code>\E[17;2~,</code></td></tr>
<tr><td><a id="key_f19">key_f19</a></td><td><code>\E[18;2~,</code></td></tr>
<tr><td><a id="key_f2">key_f2</a></td><td><code>\EOQ,</code></td></tr>
<tr><td><a id="key_f20">key_f20</a></td><td><code>\E[19;2~,</code></td></tr>
<tr><td><a id="key_f21">key_f21</a></td><td><code>\E[20;2~,</code></td></tr>
<tr><td><a id="key_f22">key_f22</a></td><td><code>\E[21;2~,</code></td></tr>
<tr><td><a id="key_f23">key_f23</a></td><td><code>\E[23;2~,</code></td></tr>
<tr><td><a id="key_f24">key_f24</a></td><td><code>\E[24;2~,</code></td></tr>
<tr><td><a id="key_f25">key_f25</a></td><td><code>\EO5P,</code></td></tr>
<tr><td><a id="key_f26">key_f26</a></td><td><code>\EO5Q,</code></td></tr>
<tr><td><a id="key_f27">key_f27</a></td><td><code>\EO5R,</code></td></tr>
<tr><td><a id="key_f28">key_f28</a></td><td><code>\EO5S,</code></td></tr>
<tr><td><a id="key_f29">key_f29</a></td><td><code>\E[15;5~,</code></td></tr>
<tr><td><a id="key_f3">key_f3</a></td><td><code>\EOR,</code></td></tr>
<tr><td><a id="key_f30">key_f30</a></td><td><code>\E[17;5~,</code></td></tr>
<tr><td><a id="key_f31">key_f31</a></td><td><code>\E[18;5~,</code></td></tr>
<tr><td><a id="key_f32">key_f32</a></td><td><code>\E[19;5~,</code></td></tr>
<tr><td><a id="key_f33">key_f33</a></td><td><code>\E[20;5~,</code></td></tr>
<tr><td><a id="key_f34">key_f34</a></td><td><code>\E[21;5~,</code></td></tr>
<tr><td><a id="key_f35">key_f35</a></td><td><code>\E[23;5~,</code></td></tr>
<tr><td><a id="key_f36">key_f36</a></td><td><code>\E[24;5~,</code></td></tr>
<tr><td><a id="key_f37">key_f37</a></td><td><code>\EO6P,</code></td></tr>
<tr><td><a id="key_f38">key_f38</a></td><td><code>\EO6Q,</code></td></tr>
<tr><td><a id="key_f39">key_f39</a></td><td><code>\EO6R,</code></td></tr>
<tr><td><a id="key_f4">key_f4</a></td><td><code>\EOS,</code></td></tr>
<tr><td><a id="key_f40">key_f40</a></td><td><code>\EO6S,</code></td></tr>
<tr><td><a id="key_f41">key_f41</a></td><td><code>\E[15;6~,</code></td></tr>
<tr><td><a id="key_f42">key_f42</a></td><td><code>\E[17;6~,</code></td></tr>
<tr><td><a id="key_f43">key_f43</a></td><td><code>\E[18;6~,</code></td></tr>
<tr><td><a id="key_f44">key_f44</a></td><td><code>\E[19;6~,</code></td></tr>
<tr><td><a id="key_f45">key_f45</a></td><td><code>\E[20;6~,</code></td></tr>
<tr><td><a id="key_f46">key_f46</a></td><td><code>\E[21;6~,</code></td></tr>
<tr><td><a id="key_f47">key_f47</a></td><td><code>\E[23;6~,</code></td></tr>
<tr><td><a id="key_f48">key_f48</a></td><td><code>\E[24;6~,</code></td></tr>
<tr><td><a id="key_f49">key_f49</a></td><td><code>\EO3P,</code></td></tr>
<tr><td><a id="key_f5">key_f5</a></td><td><code>\E[15~,</code></td></tr>
<tr><td><a id="key_f50">key_f50</a></td><td><code>\EO3Q,</code></td></tr>
<tr><td><a id="key_f51">key_f51</a></td><td><code>\EO3R,</code></td></tr>
<tr><td><a id="key_f52">key_f52</a></td><td><code>\EO3S,</code></td></tr>
<tr><td><a id="key_f53">key_f53</a></td><td><code>\E[15;3~,</code></td></tr>
<tr><td><a id="key_f54">key_f54</a></td><td><code>\E[17;3~,</code></td></tr>
<tr><td><a id="key_f55">key_f55</a></td><td><code>\E[18;3~,</code></td></tr>
<tr><td><a id="key_f56">key_f56</a></td><td><code>\E[19;3~,</code></td></tr>
<tr><td><a id="key_f57">key_f57</a></td><td><code>\E[20;3~,</code></td></tr>
<tr><td><a id="key_f58">key_f58</a></td><td><code>\E[21;3~,</code></td></tr>
<tr><td><a id="key_f59">key_f59</a></td><td><code>\E[23;3~,</code></td></tr>
<tr><td><a id="key_f6">key_f6</a></td><td><code>\E[17~,</code></td></tr>
<tr><td><a id="key_f60">key_f60</a></td><td><code>\E[24;3~,</code></td></tr>
<tr><td><a id="key_f61">key_f61</a></td><td><code>\EO4P,</code></td></tr>
<tr><td><a id="key_f62">key_f62</a></td><td><code>\EO4Q,</code></td></tr>
<tr><td><a id="key_f63">key_f63</a></td><td><code>\EO4R,</code></td></tr>
<tr><td><a id="key_f7">key_f7</a></td><td><code>\E[18~,</code></td></tr>
<tr><td><a id="key_f8">key_f8</a></td><td><code>\E[19~,</code></td></tr>
<tr><td><a id="key_f9">key_f9</a></td><td><code>\E[20~,</code></td></tr>
<tr><td><a id="key_home">key_home</a></td><td><code>\EOH,</code></td></tr>
<tr><td><a id="key_ic">key_ic</a></td><td><code>\E[2~,</code></td></tr>
<tr><td><a id="key_left">key_left</a></td><td><code>\EOD,</code></td></tr>
<tr><td><a id="key_mouse">key_mouse</a></td><td><code>\E[M,</code></td></tr>
<tr><td><a id="key_npage">key_npage</a></td><td><code>\E[6~,</code></td></tr>
<tr><td><a id="key_ppage">key_ppage</a></td><td><code>\E[5~,</code></td></tr>
<tr><td><a id="key_right">key_right</a></td><td><code>\EOC,</code></td></tr>
<tr><td><a id="key_sdc">key_sdc</a></td><td><code>\E[3;2~,</code></td></tr>
<tr><td><a id="key_send">key_send</a></td><td><code>\E[1;2F,</code></td></tr>
<tr><td><a id="key_sf">key_sf</a></td><td><code>\E[1;2B,</code></td></tr>
<tr><td><a id="key_shome">key_shome</a></td><td><code>\E[1;2H,</code></td></tr>
<tr><td><a id="key_sic">key_sic</a></td><td><code>\E[2;2~,</code></td></tr>
<tr><td><a id="key_sleft">key_sleft</a></td><td><code>\E[1;2D,</code></td></tr>
<tr><td><a id="key_snext">key_snext</a></td><td><code>\E[6;2~,</code></td></tr>
<tr><td><a id="key_sprevious">key_sprevious</a></td><td><code>\E[5;2~,</code></td></tr>
<tr><td><a id="key_sr">key_sr</a></td><td><code>\E[1;2A,</code></td></tr>
<tr><td><a id="key_sright">key_sright</a></td><td><code>\E[1;2C,</code></td></tr>
<tr><td><a id="key_up">key_up</a></td><td><code>\EOA,</code></td></tr>
<tr><td><a id="keypad_local">keypad_local</a></td><td><code>\E[?1l\E&gt;,</code></td></tr>
<tr><td><a id="keypad_xmit">\E[?1h\E</a></td><td><code>,</code></td></tr>
<tr><td><a id="memory_lock">memory_lock</a></td><td><code>\El,</code></td></tr>
<tr><td><a id="memory_unlock">memory_unlock</a></td><td><code>\Em,</code></td></tr>
<tr><td><a id="orig_pair">orig_pair</a></td><td><code>\E[39;49m,</code></td></tr>
<tr><td><a id="parm_dch">parm_dch</a></td><td><code>\E[%p1%dP,</code></td></tr>
<tr><td><a id="parm_delete_line">parm_delete_line</a></td><td><code>\E[%p1%dM,</code></td></tr>
<tr><td><a id="parm_down_cursor">parm_down_cursor</a></td><td><code>\E[%p1%dB,</code></td></tr>
<tr><td><a id="parm_ich">parm_ich</a></td><td><code>\E[%p1%d@,</code></td></tr>
<tr><td><a id="parm_index">parm_index</a></td><td><code>\E[%p1%dS,</code></td></tr>
<tr><td><a id="parm_insert_line">parm_insert_line</a></td><td><code>\E[%p1%dL,</code></td></tr>
<tr><td><a id="parm_left_cursor">parm_left_cursor</a></td><td><code>\E[%p1%dD,</code></td></tr>
<tr><td><a id="parm_right_cursor">parm_right_cursor</a></td><td><code>\E[%p1%dC,</code></td></tr>
<tr><td><a id="parm_rindex">parm_rindex</a></td><td><code>\E[%p1%dT,</code></td></tr>
<tr><td><a id="parm_up_cursor">parm_up_cursor</a></td><td><code>\E[%p1%dA,</code></td></tr>
<tr><td><a id="print_screen">print_screen</a></td><td><code>\E[i,</code></td></tr>
<tr><td><a id="prtr_off">prtr_off</a></td><td><code>\E[4i,</code></td></tr>
<tr><td><a id="prtr_on">prtr_on</a></td><td><code>\E[5i,</code></td></tr>
<tr><td><a id="reset_1string">reset_1string</a></td><td><code>\Ec,</code></td></tr>
<tr><td><a id="reset_2string">reset_2string</a></td><td><code>\E[\041p\E[?3;4l\E[4l\E&gt;,</code></td></tr>
<tr><td><a id="restore_cursor">restore_cursor</a></td><td><code>\E8,</code></td></tr>
<tr><td><a id="row_address">row_address</a></td><td><code>\E[%i%p1%dd,</code></td></tr>
<tr><td><a id="save_cursor">save_cursor</a></td><td><code>\E7,</code></td></tr>
<tr><td><a id="scroll_forward">scroll_forward</a></td><td><code>^J,</code></td></tr>
<tr><td><a id="scroll_reverse">scroll_reverse</a></td><td><code>\EM,</code></td></tr>
<tr><td><a id="set_a_background">set_a_background</a></td><td><code>\E[%?%p1%{8}%</code></td></tr>
</tbody></table>




<h2>Term Sorted</h2>
<pre>./MKtermsort.sh |sed &#039;s/.*\/\*  \(.*\)  \*\//\1/g&#039;|sort -u|grep ^[a-zA-Z]|sortwc|grep -v ^static|sort -d|tr " " &#039;,&#039;|sed &#039;s/\([^,]\{1,\}\),/&lt;var&gt;\1&lt;\/var&gt;,/g&#039;</pre>
<p><var>AB</var>,<var>ac</var>,<var>acs_btee</var>,<var>acsc</var>,<var>acs_chars</var>,<var>acs_hline</var>,<var>acs_llcorner</var>,<var>acs_lrcorner</var>,<var>acs_ltee</var>,<var>acs_plus</var>,<var>acs_rtee</var>,<var>acs_ttee</var>,<var>acs_ulcorner</var>,<var>acs_urcorner</var>,<var>acs_vline</var>,<var>ae</var>,<var>AF</var>,<var>al</var>,<var>AL</var>,<var>alt_scancode_esc</var>,<var>am</var>,<var>apstr</var>,<var>arrow_key_map</var>,<var>as</var>,<var>auto_left_margin</var>,<var>auto_right_margin</var>,<var>back_color_erase</var>,<var>backspace_delay</var>,<var>backspace_if_not_bs</var>,<var>backspaces_with_bs</var>,<var>back_tab</var>,<var>batt1</var>,<var>batt2</var>,<var>bc</var>,<var>bce</var>,<var>bel</var>,<var>bell</var>,<var>bicr</var>,<var>binel</var>,<var>birep</var>,<var>bit_image_carriage_return</var>,<var>bit_image_entwining</var>,<var>bit_image_newline</var>,<var>bit_image_repeat</var>,<var>bit_image_type</var>,<var>bitwin</var>,<var>bitype</var>,<var>bl</var>,<var>blink</var>,<var>bold</var>,<var>box1</var>,<var>box2</var>,<var>box_chars_1</var>,<var>bs</var>,<var>bt</var>,<var>BT</var>,<var>btml</var>,<var>btns</var>,<var>buffer_capacity</var>,<var>bufsz</var>,<var>buttons</var>,<var>bw</var>,<var>bx</var>,<var>can_change</var>,<var>carriage_return</var>,<var>carriage_return_delay</var>,<var>cb</var>,<var>cbt</var>,<var>cc</var>,<var>CC</var>,<var>ccc</var>,<var>cd</var>,<var>ce</var>,<var>ceol_standout_glitch</var>,<var>ch</var>,<var>change_char_pitch</var>,<var>change_line_pitch</var>,<var>change_res_horz</var>,<var>change_res_vert</var>,<var>change_scroll_region</var>,<var>char_padding</var>,<var>char_set_names</var>,<var>chr</var>,<var>chts</var>,<var>ci</var>,<var>civis</var>,<var>cl</var>,<var>clear</var>,<var>clear_all_tabs</var>,<var>clear_margins</var>,<var>clear_screen</var>,<var>clr_bol</var>,<var>clr_eol</var>,<var>clr_eos</var>,<var>cm</var>,<var>CM</var>,<var>cmdch</var>,<var>cnorm</var>,<var>co</var>,<var>Co</var>,<var>code_set_init</var>,<var>col_addr_glitch</var>,<var>colb0</var>,<var>colb1</var>,<var>colb2</var>,<var>colb3</var>,<var>colb4</var>,<var>colb5</var>,<var>colb6</var>,<var>colb7</var>,<var>colf0</var>,<var>colf1</var>,<var>colf2</var>,<var>colf3</var>,<var>colf4</var>,<var>colf5</var>,<var>colf6</var>,<var>colf7</var>,<var>color_names</var>,<var>colornm</var>,<var>colors</var>,<var>cols</var>,<var>column_address</var>,<var>columns</var>,<var>command_character</var>,<var>cpi</var>,<var>cpi_changes_res</var>,<var>cpix</var>,<var>cps</var>,<var>cr</var>,<var>cr_cancels_micro_mode</var>,<var>create_window</var>,<var>crt_no_scrolling</var>,<var>crxm</var>,<var>cs</var>,<var>csin</var>,<var>csnm</var>,<var>csr</var>,<var>ct</var>,<var>cub</var>,<var>cub1</var>,<var>cud</var>,<var>cud1</var>,<var>cuf</var>,<var>cuf1</var>,<var>cup</var>,<var>cursor_address</var>,<var>cursor_down</var>,<var>cursor_home</var>,<var>cursor_invisible</var>,<var>cursor_left</var>,<var>cursor_mem_address</var>,<var>cursor_normal</var>,<var>cursor_right</var>,<var>cursor_to_ll</var>,<var>cursor_up</var>,<var>cursor_visible</var>,<var>cuu</var>,<var>cuu1</var>,<var>cv</var>,<var>cvr</var>,<var>cvvis</var>,<var>CW</var>,<var>cwin</var>,<var>da</var>,<var>daisy</var>,<var>db</var>,<var>dB</var>,<var>dc</var>,<var>dC</var>,<var>DC</var>,<var>dch</var>,<var>dch1</var>,<var>dclk</var>,<var>defbi</var>,<var>defc</var>,<var>define_bit_image_region</var>,<var>define_char</var>,<var>delete_character</var>,<var>delete_line</var>,<var>dest_tabs_magic_smso</var>,<var>device_type</var>,<var>devt</var>,<var>DI</var>,<var>dial</var>,<var>dial_phone</var>,<var>dim</var>,<var>dispc</var>,<var>display_clock</var>,<var>display_pc_char</var>,<var>dis_status_line</var>,<var>DK</var>,<var>dl</var>,<var>DL</var>,<var>dl1</var>,<var>dm</var>,<var>dN</var>,<var>do</var>,<var>DO</var>,<var>docr</var>,<var>dot_horz_spacing</var>,<var>dot_vert_spacing</var>,<var>down_half_line</var>,<var>ds</var>,<var>dsl</var>,<var>dT</var>,<var>dv</var>,<var>eA</var>,<var>eat_newline_glitch</var>,<var>ec</var>,<var>ech</var>,<var>ed</var>,<var>ehhlm</var>,<var>ei</var>,<var>el</var>,<var>el1</var>,<var>elhlm</var>,<var>elohlm</var>,<var>ena_acs</var>,<var>enacs</var>,<var>endbi</var>,<var>end_bit_image_region</var>,<var>enter_alt_charset_mode</var>,<var>enter_am_mode</var>,<var>enter_blink_mode</var>,<var>enter_bold_mode</var>,<var>enter_ca_mode</var>,<var>enter_delete_mode</var>,<var>enter_dim_mode</var>,<var>enter_doublewide_mode</var>,<var>enter_draft_quality</var>,<var>enter_horizontal_hl_mode</var>,<var>enter_insert_mode</var>,<var>enter_italics_mode</var>,<var>enter_left_hl_mode</var>,<var>enter_leftward_mode</var>,<var>enter_low_hl_mode</var>,<var>enter_micro_mode</var>,<var>enter_near_letter_quality</var>,<var>enter_normal_quality</var>,<var>enter_pc_charset_mode</var>,<var>enter_protected_mode</var>,<var>enter_reverse_mode</var>,<var>enter_right_hl_mode</var>,<var>enter_scancode_mode</var>,<var>enter_secure_mode</var>,<var>enter_shadow_mode</var>,<var>enter_standout_mode</var>,<var>enter_subscript_mode</var>,<var>enter_superscript_mode</var>,<var>enter_top_hl_mode</var>,<var>enter_underline_mode</var>,<var>enter_upward_mode</var>,<var>enter_vertical_hl_mode</var>,<var>enter_xon_mode</var>,<var>eo</var>,<var>erase_chars</var>,<var>erase_overstrike</var>,<var>erhlm</var>,<var>es</var>,<var>eslok</var>,<var>ethlm</var>,<var>evhlm</var>,<var>exit_alt_charset_mode</var>,<var>exit_am_mode</var>,<var>exit_attribute_mode</var>,<var>exit_ca_mode</var>,<var>exit_delete_mode</var>,<var>exit_doublewide_mode</var>,<var>exit_insert_mode</var>,<var>exit_italics_mode</var>,<var>exit_leftward_mode</var>,<var>exit_micro_mode</var>,<var>exit_pc_charset_mode</var>,<var>exit_scancode_mode</var>,<var>exit_shadow_mode</var>,<var>exit_standout_mode</var>,<var>exit_subscript_mode</var>,<var>exit_superscript_mode</var>,<var>exit_underline_mode</var>,<var>exit_upward_mode</var>,<var>exit_xon_mode</var>,<var>F1</var>,<var>F2</var>,<var>F3</var>,<var>F4</var>,<var>F5</var>,<var>F6</var>,<var>F7</var>,<var>F8</var>,<var>F9</var>,<var>Fa</var>,<var>FA</var>,<var>Fb</var>,<var>FB</var>,<var>Fc</var>,<var>FC</var>,<var>Fd</var>,<var>FD</var>,<var>Fe</var>,<var>FE</var>,<var>ff</var>,<var>Ff</var>,<var>FF</var>,<var>Fg</var>,<var>FG</var>,<var>fh</var>,<var>Fh</var>,<var>FH</var>,<var>Fi</var>,<var>FI</var>,<var>fixed_pause</var>,<var>Fj</var>,<var>FJ</var>,<var>Fk</var>,<var>FK</var>,<var>Fl</var>,<var>FL</var>,<var>flash</var>,<var>flash_hook</var>,<var>flash_screen</var>,<var>fln</var>,<var>Fm</var>,<var>FM</var>,<var>Fn</var>,<var>FN</var>,<var>Fo</var>,<var>FO</var>,<var>font0</var>,<var>font1</var>,<var>font2</var>,<var>font3</var>,<var>font4</var>,<var>font5</var>,<var>font6</var>,<var>font7</var>,<var>form_feed</var>,<var>Fp</var>,<var>FP</var>,<var>Fq</var>,<var>FQ</var>,<var>Fr</var>,<var>FR</var>,<var>from_status_line</var>,<var>fs</var>,<var>FS</var>,<var>fsl</var>,<var>FT</var>,<var>FU</var>,<var>FV</var>,<var>FW</var>,<var>FX</var>,<var>FY</var>,<var>FZ</var>,<var>G1</var>,<var>G2</var>,<var>G3</var>,<var>G4</var>,<var>GC</var>,<var>GD</var>,<var>generic_type</var>,<var>getm</var>,<var>get_mouse</var>,<var>GH</var>,<var>GL</var>,<var>Gm</var>,<var>gn</var>,<var>gnu_has_meta_key</var>,<var>goto_window</var>,<var>GR</var>,<var>GU</var>,<var>GV</var>,<var>hangup</var>,<var>hard_copy</var>,<var>hard_cursor</var>,<var>has_hardware_tabs</var>,<var>has_meta_key</var>,<var>has_print_wheel</var>,<var>has_status_line</var>,<var>hc</var>,<var>HC</var>,<var>hd</var>,<var>hl</var>,<var>hls</var>,<var>ho</var>,<var>home</var>,<var>hook</var>,<var>horizontal_tab_delay</var>,<var>hpa</var>,<var>hs</var>,<var>ht</var>,<var>hts</var>,<var>hu</var>,<var>HU</var>,<var>hue_lightness_saturation</var>,<var>hup</var>,<var>hz</var>,<var>i1</var>,<var>i2</var>,<var>i3</var>,<var>ic</var>,<var>Ic</var>,<var>IC</var>,<var>ich</var>,<var>ich1</var>,<var>if</var>,<var>il</var>,<var>il1</var>,<var>im</var>,<var>in</var>,<var>ind</var>,<var>indn</var>,<var>init_1string</var>,<var>init_2string</var>,<var>init_3string</var>,<var>initc</var>,<var>init_file</var>,<var>initialize_color</var>,<var>initial
ize_pair</var>,<var>initp</var>,<var>init_prog</var>,<var>init_tabs</var>,<var>insert_character</var>,<var>insert_line</var>,<var>insert_null_glitch</var>,<var>insert_padding</var>,<var>invis</var>,<var>ip</var>,<var>iP</var>,<var>Ip</var>,<var>iprog</var>,<var>is</var>,<var>is1</var>,<var>is2</var>,<var>is3</var>,<var>it</var>,<var>k;</var>,<var>k0</var>,<var>k1</var>,<var>K1</var>,<var>k2</var>,<var>K2</var>,<var>k3</var>,<var>K3</var>,<var>k4</var>,<var>K4</var>,<var>k5</var>,<var>K5</var>,<var>k6</var>,<var>k7</var>,<var>k8</var>,<var>k9</var>,<var>ka</var>,<var>kA</var>,<var>ka1</var>,<var>ka3</var>,<var>kact</var>,<var>kb</var>,<var>kB</var>,<var>kb2</var>,<var>kbeg</var>,<var>kBEG</var>,<var>kbs</var>,<var>kbtab</var>,<var>kC</var>,<var>kc1</var>,<var>kc3</var>,<var>kcan</var>,<var>kCAN</var>,<var>kcbt</var>,<var>kclo</var>,<var>kclr</var>,<var>kcmd</var>,<var>kCMD</var>,<var>kcpn</var>,<var>kcpy</var>,<var>kCPY</var>,<var>kcrt</var>,<var>kCRT</var>,<var>kctab</var>,<var>kcub1</var>,<var>kcud1</var>,<var>kcuf1</var>,<var>kcuu1</var>,<var>kd</var>,<var>kD</var>,<var>kDC</var>,<var>kdch1</var>,<var>kDL</var>,<var>kdl1</var>,<var>kdo</var>,<var>ke</var>,<var>kE</var>,<var>ked</var>,<var>kel</var>,<var>kend</var>,<var>kEND</var>,<var>kent</var>,<var>kEOL</var>,<var>kext</var>,<var>kEXT</var>,<var>key_a1</var>,<var>key_a3</var>,<var>key_b2</var>,<var>key_backspace</var>,<var>key_beg</var>,<var>key_btab</var>,<var>key_c1</var>,<var>key_c3</var>,<var>key_cancel</var>,<var>key_catab</var>,<var>key_clear</var>,<var>key_close</var>,<var>key_command</var>,<var>key_copy</var>,<var>key_create</var>,<var>key_ctab</var>,<var>key_dc</var>,<var>key_dl</var>,<var>key_down</var>,<var>key_eic</var>,<var>key_end</var>,<var>key_enter</var>,<var>key_eol</var>,<var>key_eos</var>,<var>key_exit</var>,<var>key_f0</var>,<var>key_f1</var>,<var>key_f10</var>,<var>key_f11</var>,<var>key_f12</var>,<var>key_f13</var>,<var>key_f14</var>,<var>key_f15</var>,<var>key_f16</var>,<var>key_f17</var>,<var>key_f18</var>,<var>key_f19</var>,<var>key_f2</var>,<var>key_f20</var>,<var>key_f21</var>,<var>key_f22</var>,<var>key_f23</var>,<var>key_f24</var>,<var>key_f25</var>,<var>key_f26</var>,<var>key_f27</var>,<var>key_f28</var>,<var>key_f29</var>,<var>key_f3</var>,<var>key_f30</var>,<var>key_f31</var>,<var>key_f32</var>,<var>key_f33</var>,<var>key_f34</var>,<var>key_f35</var>,<var>key_f36</var>,<var>key_f37</var>,<var>key_f38</var>,<var>key_f39</var>,<var>key_f4</var>,<var>key_f40</var>,<var>key_f41</var>,<var>key_f42</var>,<var>key_f43</var>,<var>key_f44</var>,<var>key_f45</var>,<var>key_f46</var>,<var>key_f47</var>,<var>key_f48</var>,<var>key_f49</var>,<var>key_f5</var>,<var>key_f50</var>,<var>key_f51</var>,<var>key_f52</var>,<var>key_f53</var>,<var>key_f54</var>,<var>key_f55</var>,<var>key_f56</var>,<var>key_f57</var>,<var>key_f58</var>,<var>key_f59</var>,<var>key_f6</var>,<var>key_f60</var>,<var>key_f61</var>,<var>key_f62</var>,<var>key_f63</var>,<var>key_f7</var>,<var>key_f8</var>,<var>key_f9</var>,<var>key_find</var>,<var>key_help</var>,<var>key_home</var>,<var>key_ic</var>,<var>key_il</var>,<var>key_left</var>,<var>key_ll</var>,<var>key_mark</var>,<var>key_message</var>,<var>key_mouse</var>,<var>key_move</var>,<var>key_next</var>,<var>key_npage</var>,<var>key_open</var>,<var>key_options</var>,<var>keypad_local</var>,<var>keypad_xmit</var>,<var>key_ppage</var>,<var>key_previous</var>,<var>key_print</var>,<var>key_redo</var>,<var>key_reference</var>,<var>key_refresh</var>,<var>key_replace</var>,<var>key_restart</var>,<var>key_resume</var>,<var>key_right</var>,<var>key_save</var>,<var>key_sbeg</var>,<var>key_scancel</var>,<var>key_scommand</var>,<var>key_scopy</var>,<var>key_screate</var>,<var>key_sdc</var>,<var>key_sdl</var>,<var>key_select</var>,<var>key_send</var>,<var>key_seol</var>,<var>key_sexit</var>,<var>key_sf</var>,<var>key_sfind</var>,<var>key_shelp</var>,<var>key_shome</var>,<var>key_sic</var>,<var>key_sleft</var>,<var>key_smessage</var>,<var>key_smove</var>,<var>key_snext</var>,<var>key_soptions</var>,<var>key_sprevious</var>,<var>key_sprint</var>,<var>key_sr</var>,<var>key_sredo</var>,<var>key_sreplace</var>,<var>key_sright</var>,<var>key_srsume</var>,<var>key_ssave</var>,<var>key_ssuspend</var>,<var>key_stab</var>,<var>key_sundo</var>,<var>key_suspend</var>,<var>key_undo</var>,<var>key_up</var>,<var>kF</var>,<var>kf0</var>,<var>kf1</var>,<var>kf10</var>,<var>kf11</var>,<var>kf12</var>,<var>kf13</var>,<var>kf14</var>,<var>kf15</var>,<var>kf16</var>,<var>kf17</var>,<var>kf18</var>,<var>kf19</var>,<var>kf2</var>,<var>kf20</var>,<var>kf21</var>,<var>kf22</var>,<var>kf23</var>,<var>kf24</var>,<var>kf25</var>,<var>kf26</var>,<var>kf27</var>,<var>kf28</var>,<var>kf29</var>,<var>kf3</var>,<var>kf30</var>,<var>kf31</var>,<var>kf32</var>,<var>kf33</var>,<var>kf34</var>,<var>kf35</var>,<var>kf36</var>,<var>kf37</var>,<var>kf38</var>,<var>kf39</var>,<var>kf4</var>,<var>kf40</var>,<var>kf41</var>,<var>kf42</var>,<var>kf43</var>,<var>kf44</var>,<var>kf45</var>,<var>kf46</var>,<var>kf47</var>,<var>kf48</var>,<var>kf49</var>,<var>kf5</var>,<var>kf50</var>,<var>kf51</var>,<var>kf52</var>,<var>kf53</var>,<var>kf54</var>,<var>kf55</var>,<var>kf56</var>,<var>kf57</var>,<var>kf58</var>,<var>kf59</var>,<var>kf6</var>,<var>kf60</var>,<var>kf61</var>,<var>kf62</var>,<var>kf63</var>,<var>kf7</var>,<var>kf8</var>,<var>kf9</var>,<var>kfnd</var>,<var>kFND</var>,<var>kh</var>,<var>kH</var>,<var>khlp</var>,<var>kHLP</var>,<var>kHOM</var>,<var>khome</var>,<var>khts</var>,<var>kI</var>,<var>kIC</var>,<var>kich1</var>,<var>kil1</var>,<var>kind</var>,<var>kl</var>,<var>kL</var>,<var>kLFT</var>,<var>kll</var>,<var>km</var>,<var>kM</var>,<var>Km</var>,<var>kmous</var>,<var>kmov</var>,<var>kMOV</var>,<var>kmpf1</var>,<var>kmpf2</var>,<var>kmpf3</var>,<var>kmpf4</var>,<var>kmpf5</var>,<var>kmpf6</var>,<var>kmpf7</var>,<var>kmpf8</var>,<var>kmpf9</var>,<var>kmpt1</var>,<var>kmpt2</var>,<var>kmpt3</var>,<var>kmpt4</var>,<var>kmpt5</var>,<var>kmpt6</var>,<var>kmpt7</var>,<var>kmpt8</var>,<var>kmpt9</var>,<var>kmrk</var>,<var>kmsg</var>,<var>kMSG</var>,<var>kn</var>,<var>kN</var>,<var>knl</var>,<var>knp</var>,<var>knpn</var>,<var>knxt</var>,<var>kNXT</var>,<var>ko</var>,<var>kopn</var>,<var>kopt</var>,<var>kOPT</var>,<var>kP</var>,<var>kpp</var>,<var>kppn</var>,<var>kprt</var>,<var>kPRT</var>,<var>kprv</var>,<var>kPRV</var>,<var>kquit</var>,<var>kr</var>,<var>kR</var>,<var>krdo</var>,<var>kRDO</var>,<var>kref</var>,<var>kres</var>,<var>kRES</var>,<var>krfr</var>,<var>kri</var>,<var>kRIT</var>,<var>krmir</var>,<var>krpl</var>,<var>kRPL</var>,<var>krst</var>,<var>ks</var>,<var>kS</var>,<var>ksav</var>,<var>kSAV</var>,<var>kscl</var>,<var>kscr</var>,<var>ksel</var>,<var>ksf1</var>,<var>ksf10</var>,<var>ksf2</var>,<var>ksf3</var>,<var>ksf4</var>,<var>ksf5</var>,<var>ksf6</var>,<var>ksf7</var>,<var>ksf8</var>,<var>ksf9</var>,<var>kslt</var>,<var>kspd</var>,<var>kSPD</var>,<var>kt</var>,<var>kT</var>,<var>ktab</var>,<var>ktbc</var>,<var>ku</var>,<var>kund</var>,<var>kUND</var>,<var>l0</var>,<var>l1</var>,<var>l2</var>,<var>l3</var>,<var>l4</var>,<var>l5</var>,<var>l6</var>,<var>l7</var>,<var>l8</var>,<var>l9</var>,<var>la</var>,<var>label_format</var>,<var>label_height</var>,<var>label_off</var>,<var>label_on</var>,<var>label_width</var>,<var>lab_f0</var>,<var>lab_f1</var>,<var>lab_f10</var>,<var>lab_f2</var>,<var>lab_f3</var>,<var>lab_f4</var>,<var>lab_f5</var>,<var>lab_f6</var>,<var>lab_f7</var>,<var>lab_f8</var>,<var>lab_f9</var>,<var>le</var>,<var>LE</var>,<var>Lf</var>,<var>LF</var>,<var>lf0</var>,<var>lf1</var>,<var>lf10</var>,<var>lf2</var>,<var>lf3</var>,<var>lf4</var>,<var>lf5</var>,<var>lf6</var>,<var>lf7</var>,<var>lf8</var>,<var>lf9</var>,<var>lh</var>,<var>li</var>,<var>linefeed_if_not_lf</var>,<var>linefeed_is_newline</var>,<var>lines</var>,<var>lines_of_memory</var>,<var>ll</var>,<var>lm</var>,<var>LO</var>,<var>lpi</var>,<var>lpi_changes_res</var>,<var>lpix</var>,<var>lvert</var>,<var>lw</var>,<var>ma</var>,<var>maddr</var>,<var>magic_cookie_glitch</var>,<var>magic_cookie_glitch_ul</var>,<var>max_attributes</var>,<var>max_colors</var>,<var>maximum_windows</var>,<var>max_micro_address</va
r>,<var>max_micro_jump</var>,<var>max_pairs</var>,<var>mb</var>,<var>MC</var>,<var>mc0</var>,<var>mc4</var>,<var>mc5</var>,<var>mc5i</var>,<var>mc5p</var>,<var>mcs</var>,<var>mcub</var>,<var>mcub1</var>,<var>mcud</var>,<var>mcud1</var>,<var>mcuf</var>,<var>mcuf1</var>,<var>mcuu</var>,<var>mcuu1</var>,<var>md</var>,<var>me</var>,<var>meml</var>,<var>memory_above</var>,<var>memory_below</var>,<var>memory_lock</var>,<var>memory_unlock</var>,<var>memu</var>,<var>meta_off</var>,<var>meta_on</var>,<var>mgc</var>,<var>mh</var>,<var>mhpa</var>,<var>mi</var>,<var>Mi</var>,<var>micro_col_size</var>,<var>micro_column_address</var>,<var>micro_down</var>,<var>micro_left</var>,<var>micro_line_size</var>,<var>micro_right</var>,<var>micro_row_address</var>,<var>micro_up</var>,<var>minfo</var>,<var>mir</var>,<var>mjump</var>,<var>mk</var>,<var>ml</var>,<var>ML</var>,<var>mls</var>,<var>mm</var>,<var>mo</var>,<var>mouse_info</var>,<var>move_insert_mode</var>,<var>move_standout_mode</var>,<var>mp</var>,<var>mr</var>,<var>MR</var>,<var>mrcup</var>,<var>ms</var>,<var>msgr</var>,<var>MT</var>,<var>mu</var>,<var>mvpa</var>,<var>MW</var>,<var>nc</var>,<var>NC</var>,<var>ncv</var>,<var>nd</var>,<var>ND</var>,<var>ndscr</var>,<var>needs_xon_xoff</var>,<var>nel</var>,<var>newline</var>,<var>new_line_delay</var>,<var>nl</var>,<var>Nl</var>,<var>NL</var>,<var>nlab</var>,<var>no_color_video</var>,<var>no_correctly_working_cr</var>,<var>no_esc_ctlc</var>,<var>non_dest_scroll_region</var>,<var>non_rev_rmcup</var>,<var>no_pad_char</var>,<var>NP</var>,<var>npc</var>,<var>npins</var>,<var>NR</var>,<var>nrrmc</var>,<var>ns</var>,<var>number_of_function_keys</var>,<var>number_of_pins</var>,<var>num_labels</var>,<var>nw</var>,<var>nx</var>,<var>nxon</var>,<var>oc</var>,<var>op</var>,<var>orc</var>,<var>order_of_pins</var>,<var>orhi</var>,<var>orig_colors</var>,<var>orig_pair</var>,<var>orl</var>,<var>orvi</var>,<var>os</var>,<var>OTbc</var>,<var>OTbs</var>,<var>OTdB</var>,<var>OTdC</var>,<var>OTdN</var>,<var>OTdT</var>,<var>OTG1</var>,<var>OTG2</var>,<var>OTG3</var>,<var>OTG4</var>,<var>OTGC</var>,<var>OTGD</var>,<var>OTGH</var>,<var>OTGL</var>,<var>OTGR</var>,<var>OTGU</var>,<var>OTGV</var>,<var>other_non_function_keys</var>,<var>OTi2</var>,<var>OTkn</var>,<var>OTko</var>,<var>OTma</var>,<var>OTMT</var>,<var>OTnc</var>,<var>OTnl</var>,<var>OTNL</var>,<var>OTns</var>,<var>OTpt</var>,<var>OTrs</var>,<var>OTug</var>,<var>OTxr</var>,<var>output_res_char</var>,<var>output_res_horz_inch</var>,<var>output_res_line</var>,<var>output_res_vert_inch</var>,<var>over_strike</var>,<var>pa</var>,<var>PA</var>,<var>pad</var>,<var>pad_char</var>,<var>padding_baud_rate</var>,<var>pairs</var>,<var>parm_dch</var>,<var>parm_delete_line</var>,<var>parm_down_cursor</var>,<var>parm_down_micro</var>,<var>parm_ich</var>,<var>parm_index</var>,<var>parm_insert_line</var>,<var>parm_left_cursor</var>,<var>parm_left_micro</var>,<var>parm_right_cursor</var>,<var>parm_right_micro</var>,<var>parm_rindex</var>,<var>parm_up_cursor</var>,<var>parm_up_micro</var>,<var>pause</var>,<var>pb</var>,<var>pc</var>,<var>pc_term_options</var>,<var>pctrm</var>,<var>pf</var>,<var>pfkey</var>,<var>pfloc</var>,<var>pfx</var>,<var>pfxl</var>,<var>pk</var>,<var>pkey_key</var>,<var>pkey_local</var>,<var>pkey_plab</var>,<var>pkey_xmit</var>,<var>pl</var>,<var>plab_norm</var>,<var>pln</var>,<var>pn</var>,<var>po</var>,<var>pO</var>,<var>porder</var>,<var>print_rate</var>,<var>print_screen</var>,<var>prot</var>,<var>prtr_non</var>,<var>prtr_off</var>,<var>prtr_on</var>,<var>prtr_silent</var>,<var>ps</var>,<var>pt</var>,<var>PU</var>,<var>pulse</var>,<var>px</var>,<var>QD</var>,<var>qdial</var>,<var>quick_dial</var>,<var>r1</var>,<var>r2</var>,<var>r3</var>,<var>RA</var>,<var>rbim</var>,<var>rc</var>,<var>RC</var>,<var>rcsd</var>,<var>remove_clock</var>,<var>rep</var>,<var>repeat_char</var>,<var>req_for_input</var>,<var>req_mouse_pos</var>,<var>reqmp</var>,<var>reset_1string</var>,<var>reset_2string</var>,<var>reset_3string</var>,<var>reset_file</var>,<var>restore_cursor</var>,<var>return_does_clr_eol</var>,<var>rev</var>,<var>rf</var>,<var>RF</var>,<var>rfi</var>,<var>ri</var>,<var>RI</var>,<var>rin</var>,<var>ritm</var>,<var>rlm</var>,<var>rmacs</var>,<var>rmam</var>,<var>rmclk</var>,<var>rmcup</var>,<var>rmdc</var>,<var>rmicm</var>,<var>rmir</var>,<var>rmkx</var>,<var>rmln</var>,<var>rmm</var>,<var>rmp</var>,<var>rmpch</var>,<var>rmsc</var>,<var>rmso</var>,<var>rmul</var>,<var>rmxon</var>,<var>row_address</var>,<var>row_addr_glitch</var>,<var>rp</var>,<var>rP</var>,<var>RQ</var>,<var>rs</var>,<var>rs1</var>,<var>rs2</var>,<var>rs3</var>,<var>rshm</var>,<var>rsubm</var>,<var>rsupm</var>,<var>rum</var>,<var>rvert</var>,<var>rwidm</var>,<var>RX</var>,<var>s0</var>,<var>s0ds</var>,<var>s1</var>,<var>S1</var>,<var>s1ds</var>,<var>s2</var>,<var>S2</var>,<var>s2ds</var>,<var>s3</var>,<var>S3</var>,<var>s3ds</var>,<var>S4</var>,<var>S5</var>,<var>S6</var>,<var>S7</var>,<var>S8</var>,<var>sa</var>,<var>sA</var>,<var>SA</var>,<var>sam</var>,<var>save_cursor</var>,<var>Sb</var>,<var>sbim</var>,<var>sc</var>,<var>SC</var>,<var>scancode_escape</var>,<var>scesa</var>,<var>scesc</var>,<var>sclk</var>,<var>scp</var>,<var>scroll_forward</var>,<var>scroll_reverse</var>,<var>scs</var>,<var>scsd</var>,<var>sdrfq</var>,<var>se</var>,<var>select_char_set</var>,<var>semi_auto_right_margin</var>,<var>set0_des_seq</var>,<var>set1_des_seq</var>,<var>set2_des_seq</var>,<var>set3_des_seq</var>,<var>set_a_attributes</var>,<var>setab</var>,<var>set_a_background</var>,<var>setaf</var>,<var>set_a_foreground</var>,<var>set_attributes</var>,<var>setb</var>,<var>set_background</var>,<var>set_bottom_margin</var>,<var>set_bottom_margin_parm</var>,<var>set_clock</var>,<var>setcolor</var>,<var>set_color_band</var>,<var>set_color_pair</var>,<var>setf</var>,<var>set_foreground</var>,<var>set_left_margin</var>,<var>set_left_margin_parm</var>,<var>set_lr_margin</var>,<var>set_page_length</var>,<var>set_pglen_inch</var>,<var>set_right_margin</var>,<var>set_right_margin_parm</var>,<var>set_tab</var>,<var>set_tb_margin</var>,<var>set_top_margin</var>,<var>set_top_margin_parm</var>,<var>set_window</var>,<var>sf</var>,<var>Sf</var>,<var>SF</var>,<var>sg</var>,<var>sgr</var>,<var>sgr0</var>,<var>sgr1</var>,<var>sitm</var>,<var>sL</var>,<var>slength</var>,<var>slines</var>,<var>slm</var>,<var>smacs</var>,<var>smam</var>,<var>smcup</var>,<var>smdc</var>,<var>smgb</var>,<var>smgbp</var>,<var>smgl</var>,<var>smglp</var>,<var>smglr</var>,<var>smgr</var>,<var>smgrp</var>,<var>smgt</var>,<var>smgtb</var>,<var>smgtp</var>,<var>smicm</var>,<var>smir</var>,<var>smkx</var>,<var>smln</var>,<var>smm</var>,<var>smpch</var>,<var>smsc</var>,<var>smso</var>,<var>smul</var>,<var>smxon</var>,<var>snlq</var>,<var>snrmq</var>,<var>so</var>,<var>sp</var>,<var>spinh</var>,<var>spinv</var>,<var>sr</var>,<var>SR</var>,<var>sshm</var>,<var>ssubm</var>,<var>ssupm</var>,<var>st</var>,<var>start_bit_image</var>,<var>start_char_set_def</var>,<var>status_line_esc_ok</var>,<var>stop_bit_image</var>,<var>stop_char_set_def</var>,<var>subcs</var>,<var>subscript_characters</var>,<var>sum</var>,<var>supcs</var>,<var>superscript_characters</var>,<var>swidm</var>,<var>SX</var>,<var>ta</var>,<var>tab</var>,<var>tbc</var>,<var>te</var>,<var>termcap_init2</var>,<var>termcap_reset</var>,<var>these_cause_cr</var>,<var>ti</var>,<var>tilde_glitch</var>,<var>TO</var>,<var>tone</var>,<var>topl</var>,<var>to_status_line</var>,<var>transparent_underline</var>,<var>ts</var>,<var>tsl</var>,<var>u0</var>,<var>u1</var>,<var>u2</var>,<var>u3</var>,<var>u4</var>,<var>u5</var>,<var>u6</var>,<var>u7</var>,<var>u8</var>,<var>u9</var>,<var>uc</var>,<var>ue</var>,<var>ug</var>,<var>ul</var>,<var>underline_char</var>,<var>up</var>,<var>UP</var>,<var>up_half_line</var>,<var>us</var>,<var>user0</var>,<var>user1</var>,<var>user2</var>,<var>user3</var>,<var>user4</var>,<var>user5</var>,<var>user6</var>,<var>user7</var>,<var>user8</var>,<var>user9</var>,<var>ut</var>,<var>vb</var>,<var>ve</var>,<var>vi</var>,<var>virtual_terminal</var>,<var>vpa</var>,<var>vs</var>,<var>vt</var>,<var>WA</var>,<var>wait</var>,<var>wait_tone</var>,<var>WG</va
r>,<var>wi</var>,<var>widcs</var>,<var>wide_char_size</var>,<var>width_status_line</var>,<var>wind</var>,<var>wingo</var>,<var>wnum</var>,<var>ws</var>,<var>wsl</var>,<var>xb</var>,<var>xenl</var>,<var>XF</var>,<var>Xh</var>,<var>xhp</var>,<var>xhpa</var>,<var>xl</var>,<var>Xl</var>,<var>xmc</var>,<var>xn</var>,<var>XN</var>,<var>xo</var>,<var>Xo</var>,<var>xoffc</var>,<var>xoff_character</var>,<var>xon</var>,<var>xonc</var>,<var>xon_character</var>,<var>xon_xoff</var>,<var>xr</var>,<var>Xr</var>,<var>xs</var>,<var>xsb</var>,<var>xt</var>,<var>Xt</var>,<var>Xv</var>,<var>xvpa</var>,<var>Xy</var>,<var>Ya</var>,<var>YA</var>,<var>Yb</var>,<var>YB</var>,<var>Yc</var>,<var>YC</var>,<var>Yd</var>,<var>YD</var>,<var>Ye</var>,<var>YE</var>,<var>Yf</var>,<var>YF</var>,<var>Yg</var>,<var>YG</var>,<var>Yh</var>,<var>Yi</var>,<var>Yj</var>,<var>Yk</var>,<var>Yl</var>,<var>Ym</var>,<var>Yn</var>,<var>Yo</var>,<var>Yp</var>,<var>Yv</var>,<var>Yw</var>,<var>Yx</var>,<var>Yy</var>,<var>Yz</var>,<var>YZ</var>,<var>Za</var>,<var>ZA</var>,<var>Zb</var>,<var>ZB</var>,<var>Zc</var>,<var>ZC</var>,<var>Zd</var>,<var>ZD</var>,<var>Ze</var>,<var>ZE</var>,<var>zerom</var>,<var>zero_motion</var>,<var>Zf</var>,<var>ZF</var>,<var>Zg</var>,<var>ZG</var>,<var>Zh</var>,<var>ZH</var>,<var>Zi</var>,<var>ZI</var>,<var>Zj</var>,<var>ZJ</var>,<var>Zk</var>,<var>ZK</var>,<var>Zl</var>,<var>ZL</var>,<var>Zm</var>,<var>ZM</var>,<var>Zn</var>,<var>ZN</var>,<var>Zo</var>,<var>ZO</var>,<var>Zp</var>,<var>ZP</var>,<var>Zq</var>,<var>ZQ</var>,<var>Zr</var>,<var>ZR</var>,<var>Zs</var>,<var>ZS</var>,<var>Zt</var>,<var>ZT</var>,<var>Zu</var>,<var>ZU</var>,<var>Zv</var>,<var>ZV</var>,<var>Zw</var>,<var>ZW</var>,<var>Zx</var>,<var>ZX</var>,<var>Zy</var>,<var>ZY</var>,<var>Zz</var>,<var>ZZ</var></p>


<h2>TERMINAL TYPE DESCRIPTIONS SOURCE FILE</h2>
<pre>ANSI, UNIX CONSOLE, AND SPECIAL TYPES
Specials
ANSI.SYS/ISO 6429/ECMA-48 Capabilities
ANSI/ECMA-48 terminals and terminal emulators
DOS ANSI.SYS variants
ANSI console types
BeOS
Linux consoles
Mach
OSF Unix
QNX
NetBSD consoles
FreeBSD console entries
386BSD and BSD/OS Consoles
DEC VT52
DEC VT100 and compatibles
VT100 emulations
X terminal emulators
MGR
UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS
Pilot Pro Palm-Top
COMMERCIAL WORKSTATION CONSOLES
Alpha consoles
Sun consoles
Iris consoles
NeWS consoles
NeXT consoles
Sony NEWS workstations
Common Desktop Environment
Non-Unix Consoles
COMMON TERMINAL TYPES
Altos
Hewlett-Packard (hp)
Honeywell-Bull
Lear-Siegler (adm)
Prime
Qume (qvt)
Televideo (tvi)
Visual (vi)
Wyse (wy)
Kermit terminal emulations
NON-ANSI TERMINAL EMULATIONS
Avatar
RBcomm
LCD DISPLAYS
Matrix Orbital
OLDER TERMINAL TYPES
AT&amp;amp;T (att, tty)
Ampex (Dialogue)
Ann Arbor (aa)
Applied Digital Data Systems (adds)
C. Itoh Electronics
Control Data (cdc)
Getronics
Human Designed Systems (Concept)
Contel Business Systems.
Data General (dg)
Datamedia (dm)
Falco</pre>






<p>Just something sorta cool for you to check out</p>
<pre>{
 local t=`tputm &#039;clear&#039; &#039;setaf 75&#039;` l a b f=/tmp/ps IFS=&#039; &#039;;
exec 6&lt;&gt;$f;ps L|tr -s &#039; &#039; &amp;&gt;$f;
while read -u6 l;do a=${l/% */} b=${l/* /};
figlet -rtw $((${COLUMNS} /2 )) -f big "$l";
tput sgr0;
command ps wwo pid:6,user:8,vsize:8,comm:20,$a:50 k -$a -A;cont;
done;
};</pre><p><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html"></a><a href="http://www.askapache.com/linux/zen-terminal-escape-codes.html">Terminal Escape Code Zen</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/linux/zen-terminal-escape-codes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Linux Debugging using a Bootloader (GRUB)</title>
		<link>http://www.askapache.com/linux/advanced-linux-grub.html</link>
		<comments>http://www.askapache.com/linux/advanced-linux-grub.html#comments</comments>
		<pubDate>Thu, 07 Apr 2011 16:35:41 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=4846</guid>
		<description><![CDATA[<p>As an example, here is the boot line that I am using at the moment on an older Dell Desktop, just to illustrate module parameters and environment vars.  </p>
<pre>title  Arch Linux X-256
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait pause_on_oops=5 panic=60 i915.modeset=1 no_console_suspend ipv6.disable=1 TERM=xterm-256color quiet 5
initrd /kernel26.img</pre>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/linux/advanced-linux-grub.html"></a><a href="http://www.askapache.com/linux/advanced-linux-grub.html"><cite>AskApache.com</cite></a></p><p>This is part of the <a href="https://wiki.archlinux.org/index.php/GRUB">GRUB article on the Arch Linux wiki that I contributed</a>.   As of now, just a copy.</p>

<p>The grub <code>menu.lst</code> provides for a convenient way to add a number of entries with <a href="http://www.kernel.org/doc/Documentation/kernel-parameters.txt" class="external text" rel="nofollow">extended kernel parameters</a> to configure all sorts of advanced settings to enable you to quickly and conveniently boot into your existing system with varying levels of debugging output.  It's very easy and useful to create several levels of debugging just by adding additional entries to your grub configuration. And if you ever have issues or problems down the road due to a power-failure or hardware failure, it can save you hours of trouble, and of course nothing can beat debugging output when it comes to learning about your system.</p>

<h2><span class="mw-headline" id="Useful_Menu.lst_Entries">Useful Menu.lst Entries</span></h2>
<p>If you are interested in debugging, then you deserve some grub entries for powerusers, here are a few that I like (just add to your <code>menu.lst</code>).</p>

<pre>title Shutdown the Computer
halt
&nbsp;
title Reboot the Computer
reboot
&nbsp;
title Command Line
commandline
&nbsp;
title Install GRUB to hd0 MBR
root (hd0,0)
setup (hd0)
&nbsp;
title Matrix
color green/black light-green/green
&nbsp;
title Scan for /boot/grub/menu.lst
find --set-root --ignore-floppies /boot/grub/menu.lst
configfile /boot/grub/menu.lst
&nbsp;
title Scan for /boot/menu.lst
find --set-root --ignore-floppies /menu.lst
configfile /boot/menu.lst
&nbsp;
# http://www.vortex.prodigynet.co.uk/x86test/
title    Run x86test (CPU Info)
kernel /boot/x86test_zImage.bin
#wget http://www.vortex.prodigynet.co.uk/x86test/x86test_zImage.bin
&nbsp;
# http://www.memtest.org/
title    Run memtest86+ (Memory Testing)
kernel /boot/memtest86+-1.70.bin</pre>

<h2> <span class="mw-headline" id="Light_Debug">Light Debug</span></h2>
<p>A quick way to see more verbose messages on your console is to bootup your normal grub entry after appending <strong>verbose</strong> to the kernel line.  This simple word added to your kernel line turns on more logging thanks to the <code>/etc/rc.sysinit</code> file, which at the top of the file runs:</p>
<pre>if /bin/grep -q " verbose" /proc/cmdline; then /bin/dmesg -n 8; fi</pre>
<p>Very simple way to get a bit more messages and debug output in your logs.</p>
<pre>title  Arch Linux DEBUG Light
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait verbose
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Medium_Debug">Medium Debug</span></h2>
<p>This example <code>menu.lst</code> entry turns on real logging that is set by the kernel and not in an init script.  Adding the <strong>debug</strong> kernel parameter to your kernel line is recognized by a lot of linux internals and enables quite a bit of debugging compared to the default. </p>

<pre>title Arch Linux DEBUG Medium
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootdelay=5 panic=10 debug
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Heavy_Debug">Heavy Debug</span></h2>
<p>An even more impressive kernel parameter is the <strong>ignore_loglevel</strong>, which causes the system to ignore any loglevel and keeps the internal loglevel at the maximum debugging level, basically rendering dmesg unable to lower the debug level.</p>
<pre>title Arch Linux DEBUG Heavy
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootdelay=5 panic=10 debug ignore_loglevel
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Extreme_Debug">Extreme Debug</span></h2>
<p>If the "Heavy Debug" seemed like a lot of output, thats about 1/2 of the logging that occurs with this example.  This does a couple things, it uses the <strong>earlyprintk</strong> parameter to setup your kernel for "early" "printing" of messages to your "vga" screen.  The <strong>,keep</strong> just lets it stay on the screen longer.  This will let you see logs that normally are hidden due to the boot-up process.
This also changes the log buffer length to 10MB, and also instructs that any fatal signals be printed with <strong>print_fatal_signals</strong>.  The last one, <strong>sched_debug</strong>, you can look up in the very excellent kernel documentation on <a href="http://www.kernel.org/doc/Documentation/kernel-parameters.txt" class="external text" rel="nofollow">kernel parameters</a>.</p>

<pre>title Arch Linux DEBUG Extreme
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro debug ignore_loglevel log_buf_len=10M print_fatal_signals=1 LOGLEVEL=8 earlyprintk=vga,keep sched_debug
initrd /kernel26.img</pre>

<h2> <span class="mw-headline" id="Insane_Debug">Insane Debug</span></h2>
<p>The first few debugging examples showed some really nice kernel parameters to turn on really verbose debugging.  This kind of debugging is absolutely critical if you want to max out your system or just learn more about what is going on behind the scenes.  But there is a final trick that is my favorite, it's the ability to set both environment variables, and more importantly, module parameters at boot.</p>

<p>As an example, here is the boot line that I am using at the moment on an older Dell Desktop, just to illustrate module parameters and environment vars.  </p>
<pre>title  Arch Linux X-256
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait pause_on_oops=5 panic=60 i915.modeset=1 no_console_suspend ipv6.disable=1 TERM=xterm-256color quiet 5
initrd /kernel26.img</pre>
<p>Since it's low on both memory and CPU, I disable ipv6. I also turn on kernel modesetting for the i915 video card, set my terminal to be xterm-256color, and boot straight into <a href="https://wiki.archlinux.org/index.php/Xorg" title="Xorg">X</a>.  This lets me use a very optimized arch-linux configuration, amazing how fast thanks to using <a href="https://wiki.archlinux.org/index.php/SLiM" title="SLiM">slim</a> as the login manager, <a href="https://wiki.archlinux.org/index.php/Ratpoison" title="Ratpoison">ratpoison</a> as my <a href="https://wiki.archlinux.org/index.php/Display_Manager" title="Display Manager">window manager</a>, and terminal with <a href="https://wiki.archlinux.org/index.php/Tmux" title="Tmux">tmux</a> as my login shell, all from boot, as the pstree shows (plus <a href="https://wiki.archlinux.org/index.php/Synergy" title="Synergy">Synergy</a>!).</p>
<pre>init,1
  |-slim,3096
  |   |-X,3098 -nolisten tcp vt07 -auth /var/run/slim.auth
  |   `-ratpoison,3107,askapache
  |       |-terminal,5341 -x sh -c exec /usr/bin/tmux -2 -l -u -q attach -d -t tmux-askapache
  |       |   |-bash,11165
  |       |   |-tmux,5345 -2 -l -u -q attach -d -t tmux-askapache
  |       |   `-{terminal},5346
  |       `-xscreensaver,3113 -no-splash
  |-synergyc,6121,galileo -f --name galileo-fire --restart 10.66.66.2:26666
  |
  `-tmux,5348,askapache -2 -l -u -q attach -d -t tmux-askapache
      |-bash,5351
      |   `-ssh,9969 lug@askapache.com
      `-bash,5868
         `-vim,11149 -p sda1/grub/menu.lst /boot/grub/menu.lst</pre>
<p>That kind of optimized system is only possible if you first can figure out your system, by debugging both the kernel as previously illustrated, debugging the init process, and most importantly, by debugging the modules enabled for your system's hardware/firmware/software.  Debugging modules is challenging but worth the effort, and then you are able to do some truly insane debugging from grub like the following example, note that the actual grub entry is all on one line, but I split it into 4 lines so you could see it all.  This basically turns on every module on this little Dell desktop to be at the absolute max debug level.  There is so much logging when I boot this that the system grinds to a halt and is slower than a TI-89 calculator (See <a href="https://wiki.archlinux.org/index.php/Improve_Boot_Performance" title="Improve Boot Performance">Improve Boot Performance</a>).</p>
<pre>title  Arch Linux DEBUG INSANE
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait ignore_loglevel debug debug_locks_verbose=1 sched_debug initcall_debug mminit_loglevel=4 udev.log_priority=8
       loglevel=8 earlyprintk=vga,keep log_buf_len=10M print_fatal_signals=1 apm.debug=Y i8042.debug=Y drm.debug=1 scsi_logging_level=1 usbserial.debug=Y
       option.debug=Y pl2303.debug=Y firewire_ohci.debug=1 hid.debug=1 pci_hotplug.debug=Y pci_hotplug.debug_acpi=Y shpchp.shpchp_debug=Y apic=debug
       show_lapic=all hpet=verbose lmb=debug pause_on_oops=5 panic=10 sysrq_always_enabled
initrd /kernel26.img</pre>
<p>A couple key items from that grub entry are <strong>sysrq_always_enabled</strong> which forces on the sysrq magic, which really is a lifesaver when debugging at this level as your machine will freeze/stop-responding sometimes and it's nice to use sysrq to kill all tasks, change the loglevel, unmount all filesystems, or do a hard reboot.  Another key parameter is the <strong>initcall_debug</strong>, which debugs the init process in excruciating detail.  Very useful at times.  The last parametery I find very useful is the <strong>udev.log_priority=8</strong> to turn on <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a> logging.  </p>


<h2><span class="mw-headline" id="Break_Into_Init">Break Into Init</span></h2>
<p>For instance, If you add <strong>break=y</strong> to your kernel cmdline, init will pause early in the <a href="https://wiki.archlinux.org/index.php/Arch_Boot_Process" title="Arch Boot Process">boot process</a> (after loading modules) and launch an interactive sh shell which can be used for troubleshooting purposes. (Normal boot continues after logout.)  This is very similar to the shell that shows up if your computer gets turned off before it is able to shutdown properly.  But using this parameter lets you enter into this mode differently at will.</p>
<pre>title  Arch Linux Init Break
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro rootwait break=y
initrd /kernel26.img</pre>

<h2><span class="mw-headline" id="Debugging_init">Debugging init</span></h2>

<p>This awesome parameter <strong>udev.log_priority=8</strong> does the same thing as editing the file <code>/etc/udev/udev.conf</code> except it executes earlier, turning on debugging output for <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a>.  If you want to know your hardware, that is the key parameter right there.  Another trick is if you change the <code>/etc/udev/udev.conf</code> to be verbose, then you can make your initrd image include that file to turn on verbose udeb debugging by adding it to your {{Filename|/etc/mkinitcpio.conf} like:</p>
<pre>FILES="/etc/modprobe.d/modprobe.conf /etc/udev/udev.conf"</pre>
<p>, which on arch is as easy as </p>
<pre># mkinitcpio -p kernel26</pre>
<p>Debugging <a href="https://wiki.archlinux.org/index.php/Udev" title="Udev">udev</a> is key because the <a href="https://wiki.archlinux.org/index.php/Initrd" title="Initrd">initrd</a> performs a <a href="https://wiki.archlinux.org/index.php/Change_Root" title="Change Root">root change</a> at the end of its run to usually launch a program like /sbin/init as part of a chroot, and unless the new file system has a valid /dev directory, udev must be initialized before invoking chroot in order to provide <code>/dev/console</code>.  </p>
<pre>exec chroot . /sbin/init &lt;dev/console &gt;dev/console 2&gt;&amp;1</pre>
<p>So basically, you aren't able to view the logs that are generated before /dev/console is initialized by udev or by a special initrd you compiled yourself.  One method the kernel developers use to be able to still get the log messages generated before /dev/console is available is to provide an alternative console that you can enable or disable from grub.</p>



<h2><span class="mw-headline" id="Net_Console">Net Console</span></h2>
<p>If you read through the kernel documentation regarding debugging, you will hear about Netconsole, which can be loaded from the kernel line in GRUB, compiled into your kernel, or loaded at runtime as a module.  Having a netconsole entry in your <code>menu.lst</code> is most excellent for debugging slower computers like old laptops or thin-clients.  It's easy to use.  Just setup a 2nd computer (running arch) to accept syslog requests on a remote port, very fast and quick to do on arch-linux, 1 line to syslog.conf.  Then you could use a log-color-parser like ccze to view all syslog logs, or just tail your everything.log. Then on your laptop, boot up and select the netconsole entry from the grub menu, and you will start seeing as much logging as you want on your syslog system.  This logging lets you view even earlier log output than is available with the earlyprintk=vga kernel parameter, as netconsole is used by kernel hackers and developers, so it's very powerful.</p>
<pre>title  Arch Linux DEBUG Netconsole
kernel /vmlinuz26 root=/dev/disk/by-label/ROOT ro netconsole=514@10.0.0.2/12:34:56:78:9a:bc debug ignore_loglevel
initrd /kernel26.img</pre>

<h2><span class="mw-headline" id="Hijacking_cmdline">Hijacking cmdline</span></h2>
<p>If you do not have access to GRUB or the kernel boottime cmdline, like on a server or virtual machine, as long as you have root permissions you can still enable this kind of simplistic verbose logging using a neat hack.  While you cannot modify the <code>/proc/cmdline</code> even as root, you can place your own cmdline file on top of /proc/cmdline, so that accessing /proc/cmdline actually accesses your file.</p>
<p>For example if I <strong>cat /proc/cmdline</strong>, I have the following:</p>
<pre>root=/dev/disk/by-label/ROOT ro console=tty1 logo.nologo quiet</pre>
<p>So I use a simple sed command to replace <strong>quiet</strong> with <strong>verbose</strong> like:</p>
<pre>sed &#039;s/ quiet/ verbose/&#039; /proc/cmdline &gt; /root/cmdline</pre>
<p>Then I bind mount /root/cmdline so that it becomes /proc/cmdline, using the <strong>-n</strong> option to mount so that this mount won't be recorded in the systems mtab.</p>
<pre>mount -n --bind -o ro /root/cmdline /proc/cmdline</pre>
<p>Now if I <strong>cat /proc/cmdline</strong>, I have the following:</p>
<pre>root=/dev/disk/by-label/ROOT ro console=tty1 logo.nologo verbose</pre><p><a href="http://www.askapache.com/linux/advanced-linux-grub.html"></a><a href="http://www.askapache.com/linux/advanced-linux-grub.html">Advanced Linux Debugging using a Bootloader (GRUB)</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/linux/advanced-linux-grub.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod_Rewrite Variables Cheatsheet</title>
		<link>http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html</link>
		<comments>http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html#comments</comments>
		<pubDate>Tue, 03 Aug 2010 15:05:23 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Htaccess]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[mod_rewrite]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=1280</guid>
		<description><![CDATA[<p><a class="IFL hs hs21" href="http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html" title="mod_rewrite cheatsheet for .htaccess rewrites"></a>We've figured out what <a href="http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html">mod_rewrite variables</a> look like, a cheatsheet of the actual value. <br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html"></a><a href="http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html"><cite>AskApache.com</cite></a></p><p><a class="IFL hs hs21" href="http://uploads.askapache.com/2008/09/warningiconimg.jpg" title="mod_rewrite cheatsheet for .htaccess rewrites"></a>We've figured out what <a href="http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html">mod_rewrite variables</a> look like so we can create rewriterules and condition patterns based on the actual value.  This cheatsheet is where we'll lay them all out for quick reference.  This cheatsheet changed my life, way more than 301 redirect htaccess.<br class="C" /></p>

<h2>mod_rewrite Variable Value Cheat-Sheet</h2>
<p>Jump to: <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#API_VERSION">API_VERSION</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#AUTH_TYPE">AUTH_TYPE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#CONTENT_LENGTH">CONTENT_LENGTH</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#CONTENT_TYPE">CONTENT_TYPE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#DOCUMENT_ROOT">DOCUMENT_ROOT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#GATEWAY_INTERFACE">GATEWAY_INTERFACE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTPS">HTTPS</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_ACCEPT">HTTP_ACCEPT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_ACCEPT_CHARSET">HTTP_ACCEPT_CHARSET</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_ACCEPT_ENCODING">HTTP_ACCEPT_ENCODING</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_ACCEPT_LANGUAGE">HTTP_ACCEPT_LANGUAGE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_CACHE_CONTROL">HTTP_CACHE_CONTROL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_CONNECTION">HTTP_CONNECTION</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_COOKIE">HTTP_COOKIE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_FORWARDED">HTTP_FORWARDED</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_HOST">HTTP_HOST</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_KEEP_ALIVE">HTTP_KEEP_ALIVE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_PROXY_CONNECTION">HTTP_PROXY_CONNECTION</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_REFERER">HTTP_REFERER</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_USER_AGENT">HTTP_USER_AGENT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#IS_SUBREQ">IS_SUBREQ</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#ORIG_PATH_INFO">ORIG_PATH_INFO</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#ORIG_PATH_TRANSLATED">ORIG_PATH_TRANSLATED</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#ORIG_SCRIPT_FILENAME">ORIG_SCRIPT_FILENAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#ORIG_SCRIPT_NAME">ORIG_SCRIPT_NAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#PATH">PATH</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#PATH_INFO">PATH_INFO</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#PHP_SELF">PHP_SELF</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#QUERY_STRING">QUERY_STRING</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REDIRECT_QUERY_STRING">REDIRECT_QUERY_STRING</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REDIRECT_REMOTE_USER">REDIRECT_REMOTE_USER</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REDIRECT_STATUS">REDIRECT_STATUS</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REDIRECT_URL">REDIRECT_URL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REMOTE_ADDR">REMOTE_ADDR</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REMOTE_HOST">REMOTE_HOST</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REMOTE_IDENT">REMOTE_IDENT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REMOTE_PORT">REMOTE_PORT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REMOTE_USER">REMOTE_USER</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REQUEST_FILENAME">REQUEST_FILENAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REQUEST_METHOD">REQUEST_METHOD</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REQUEST_TIME">REQUEST_TIME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#REQUEST_URI">REQUEST_URI</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_FILENAME">SCRIPT_FILENAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_GROUP">SCRIPT_GROUP</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_NAME">SCRIPT_NAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_URI">SCRIPT_URI</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_URL">SCRIPT_URL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SCRIPT_USER">SCRIPT_USER</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_ADDR">SERVER_ADDR</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_ADMIN">SERVER_ADMIN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_NAME">SERVER_NAME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_PORT">SERVER_PORT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_PROTOCOL">SERVER_PROTOCOL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_SIGNATURE">SERVER_SIGNATURE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SERVER_SOFTWARE">SERVER_SOFTWARE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_CIPHER">SSL_CIPHER</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_CIPHER_ALGKEYSIZE">SSL_CIPHER_ALGKEYSIZE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_CIPHER_EXPORT">SSL_CIPHER_EXPORT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_CIPHER_USEKEYSIZE">SSL_CIPHER_USEKEYSIZE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_CLIENT_VERIFY">SSL_CLIENT_VERIFY</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_PROTOCOL">SSL_PROTOCOL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_A_KEY">SSL_SERVER_A_KEY</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_A_SIG">SSL_SERVER_A_SIG</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_CERT">SSL_SERVER_CERT</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN">SSL_SERVER_I_DN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_C">SSL_SERVER_I_DN_C</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_CN">SSL_SERVER_I_DN_CN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_L">SSL_SERVER_I_DN_L</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_O">SSL_SERVER_I_DN_O</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_OU">SSL_SERVER_I_DN_OU</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_I_DN_ST">SSL_SERVER_I_DN_ST</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_M_SERIAL">SSL_SERVER_M_SERIAL</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_M_VERSION">SSL_SERVER_M_VERSION</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_S_DN">SSL_SERVER_S_DN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_S_DN_CN">SSL_SERVER_S_DN_CN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_S_DN_O">SSL_SERVER_S_DN_O</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_S_DN_OU">SSL_SERVER_S_DN_OU</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_V_END">SSL_SERVER_V_END</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SERVER_V_START">SSL_SERVER_V_START</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_SESSION_ID">SSL_SESSION_ID</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_VERSION_INTERFACE">SSL_VERSION_INTERFACE</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#SSL_VERSION_LIBRARY">SSL_VERSION_LIBRARY</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#THE_REQUEST">THE_REQUEST</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME">TIME</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_DAY">TIME_DAY</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_HOUR">TIME_HOUR</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_MIN">TIME_MIN</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_MON">TIME_MON</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_SEC">TIME_SEC</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_WDAY">TIME_WDAY</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TIME_YEAR">TIME_YEAR</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#TZ">TZ</a>, <a href="/htaccess/mod_rewrite-variables-cheatsheet.html#UNIQUE_ID">UNIQUE_ID</a></p>
<dl class="dl1">
<dt><a id="API_VERSION"></a><br />API_VERSION</a>: <code>20020903:12</code></dt>
<dd><pre>RewriteCond %{API_VERSION} ^(.*)$
RewriteRule .* http://www.askapache.com?API_VERSION=%1 [R=307,L]
</pre></dd>
<dt><a id="AUTH_TYPE"></a><br />AUTH_TYPE</a>: <code>Digest</code></dt>
<dd><pre>RewriteRule .* - [E=IN_AUTH_TYPE:%{AUTH_TYPE}]
RequestHeader set AUTH_TYPE "%{IN_AUTH_TYPE}e"</pre></dd>
<dt><a id="CACHE_CONTROL"></a><br />CACHE_CONTROL</a>: <code>max-age=0</code></dt>
<dd><pre>RewriteCond %{ENV:CACHE_CONTROL} no-cache [NC]
RewriteRule . %{REQUEST_URI}?nocache [L]</pre></dd>
<dt><a id="CONNECTION"></a><br />CONNECTION</a>: <code>keep-alive</code></dt><dd></dd>
<dt><a id="CONTENT_LENGTH"></a><br />CONTENT_LENGTH</a>: <code>(null)</code></dt>
<dd><pre>RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{HTTP:Content-Length}%{CONTENT_LENGTH} ^$
RewriteRule .* - [F,NS,L]</pre></dd>
<dt><a id="CONTENT_TYPE"></a><br />CONTENT_TYPE</a>: <code>(null)</code></dt><dd></dd>
<dt><a id="DOCUMENT_ROOT"></a><br />DOCUMENT_ROOT</a>: <code>/home/webroot/askapache.com</code></dt>
<dd><pre>RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}/index.html -f
RewriteRule . /cache%{REQUEST_URI}/index.html</pre></dd>
<dt><a id="HOST"></a><br />HOST</a>: <code>www.askapache.com</code></dt>
<dd><pre>RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC]
RewriteRule . http://www.askapache.com%{REQUEST_URI} [R=301,L]</pre></dd>
<dt><a id="HTTP"></a><br />HTTP</a>:</dt>
<dd><pre>RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.gz -f
RewriteRule . %{REQUEST_URI}.gz [L]</pre></dd>
<dt><a id="HTTPS"></a><br />HTTPS</a>: <code>off</code></dt>
<dd><pre>RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]</pre></dd>
<dt><a id="HTTP_ACCEPT"></a><br />HTTP_ACCEPT</a>: <code>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</code></dt><dd></dd>
<dt><a id="HTTP_COOKIE"></a><br />HTTP_COOKIE</a>: <code>__qca=1176541205adf28-5553185; ASKAPACHEID=fdadfa4f33e62a878468; __utmc=1df3893</code></dt>
<dd><pre>RewriteCond %{HTTP_COOKIE} ^.*autostart=on.*$
RewriteRule ^(.*)\.swf$ /$1\?autostart=true [NE,L]</pre></dd>
<dt><a id="HTTP_HOST"></a><br />HTTP_HOST</a>: <code>www.askapache.com</code></dt><dd></dd>
<dt><a id="HTTP_REFERER"></a><br />HTTP_REFERER</a>: <code>http://www.askapache.com/pro/mod_rewrite/catch.php?k=i</code></dt>
<dd><pre>RewriteCond %{HTTP_REFERER} badhost [NC]
RewriteRule . - [F]</pre></dd>
<dt><a id="HTTP_USER_AGENT"></a><br />HTTP_USER_AGENT</a>: <code>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Firefox/3.0.1</code></dt>
<dd><pre>RewriteCond %{HTTP_USER_AGENT} ^.*(Android|2.0\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|hiptop|IEMobile|iPhone).*$ [NC]
RewriteRule ^(.+)$ /mobile/$1 [L]</pre></dd>
<dt><a id="IS_SUBREQ"></a><br />IS_SUBREQ</a>: <code>false</code></dt><dd></dd>
<dt><a id="KEEP_ALIVE"></a><br />KEEP_ALIVE</a>: <code>300</code></dt><dd></dd>
<dt><a id="PATH"></a><br />PATH</a>: <code>/bin:/usr/bin:/sbin:/usr/sbin</code></dt><dd></dd>
<dt><a id="QUERY_STRING"></a><br />QUERY_STRING</a>: <code>k=i</code></dt>
<dd><pre>RewriteCond %{QUERY_STRING} showtime [NC]
RewriteCond T:%{TIME}_TY:%{TIME_YEAR}_TMO:%{TIME_MON}_TWD:%{TIME_WDAY}_TD:%{TIME_DAY}_TH:%{TIME_HOUR}_TMI:%{TIME_MIN}_TS:%{TIME_SEC} ^(.*)$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}?time=%1 [R,L]</pre></dd>
<dt><a id="REMOTE_ADDR"></a><br />REMOTE_ADDR</a>: <code>22.162.134.211</code></dt>
<dd><pre>RewriteCond %{REMOTE_ADDR} !^22\.162\.134\.211$
RewriteRule . http://www.askapache.com/maintenance-in-progress.html [R=307,L]</pre></dd>
<dt><a id="REMOTE_HOST"></a><br />REMOTE_HOST</a>: <code>22.162.134.211</code></dt><dd></dd>
<dt><a id="REMOTE_PORT"></a><br />REMOTE_PORT</a>: <code>4220</code></dt><dd></dd>
<dt><a id="REMOTE_USER"></a><br />REMOTE_USER</a>: <code>askapache</code></dt>
<dd><pre>RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]</pre></dd>
<dt><a id="REQUEST_FILENAME"></a><br />REQUEST_FILENAME</a>: <code>/home/webroot/askapache.com/pro/mod_rewrite/index.php</code></dt><dd></dd>
<dt><a id="REQUEST_METHOD"></a><br />REQUEST_METHOD</a>: <code>GET</code></dt>
<dd><pre>RewriteCond %{REQUEST_METHOD} !^(POST|GET|HEAD|PROPFIND|OPTIONS)$
RewriteRule .* - [F,L]</pre></dd>
<dt><a id="REQUEST_PROTOCOL"></a><br />REQUEST_PROTOCOL</a>: <code>HTTP/1.1</code></dt>
<dd><pre>RewriteCond %{REQUEST_PROTOCOL} !^HTTP/(0\.9|1\.[01])$
RewriteRule . [F,L]</pre></dd>
<dt><a id="REQUEST_URI"></a><br />REQUEST_URI</a>: <code>/pro/mod_rewrite/index.php</code></dt>
<dd><pre>RewriteCond %{REQUEST_URI} ^(robots\.txt|favicon\|ico)$ [NC]
RewriteRule . - [S=1]
RewriteCond %{HTTP_HOST} ^www
RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]</pre></dd>
<dt><a id="SCRIPT_FILENAME"></a><br />SCRIPT_FILENAME</a>: <code>/home/webroot/askapache.com/pro/mod_rewrite/index.php</code></dt><dd></dd>
<dt><a id="SCRIPT_GROUP"></a><br />SCRIPT_GROUP</a>: <code>daemong</code></dt><dd></dd>
<dt><a id="SCRIPT_URI"></a><br />SCRIPT_URI</a>: <code>http://www.askapache.com/pro/mod_rewrite/index.php</code></dt><dd></dd>
<dt><a id="SCRIPT_URL"></a><br />SCRIPT_URL</a>: <code>/pro/mod_rewrite/index.php</code></dt><dd></dd>
<dt><a id="SCRIPT_USER"></a><br />SCRIPT_USER</a>: <code>askapache</code></dt><dd></dd>
<dt><a id="SERVER_ADDR"></a><br />SERVER_ADDR</a>: <code>208.113.134.190</code></dt><dd></dd>
<dt><a id="SERVER_ADMIN"></a><br />SERVER_ADMIN</a>: <code>webmaster@askapache.com</code></dt><dd></dd>
<dt><a id="SERVER_NAME"></a><br />SERVER_NAME</a>: <code>www.askapache.com</code></dt><dd></dd>
<dt><a id="SERVER_PORT"></a><br />SERVER_PORT</a>: <code>80</code></dt><dd></dd>
<dt><a id="SERVER_PROTOCOL"></a><br />SERVER_PROTOCOL</a>: <code>HTTP/1.1</code></dt><dd></dd>
<dt><a id="SERVER_SOFTWARE"></a><br />SERVER_SOFTWARE</a>: <code>Apache/2.0.61 (Unix) PHP/5.5 OpenSSL/0.9.7e</code></dt><dd></dd>
<dt><a id="SSL_CIPHER"></a><br />SSL_CIPHER</a>: <code>DHE-RSA-AES256-SHA</code></dt><dd></dd>
<dt><a id="SSL_CIPHER_ALGKEYSIZE"></a><br />SSL_CIPHER_ALGKEYSIZE</a>: <code>256</code></dt><dd></dd>
<dt><a id="SSL_CIPHER_EXPORT"></a><br />SSL_CIPHER_EXPORT</a>: <code>false</code></dt><dd></dd>
<dt><a id="SSL_CIPHER_USEKEYSIZE"></a><br />SSL_CIPHER_USEKEYSIZE</a>: <code>256</code></dt><dd></dd>
<dt><a id="SSL_CLIENT_VERIFY"></a><br />SSL_CLIENT_VERIFY</a>: <code>NONE</code></dt><dd></dd>
<dt><a id="SSL_PROTOCOL"></a><br />SSL_PROTOCOL</a>: <code>TLSv1</code></dt><dd></dd>
<dt><a id="SSL_SERVER_A_KEY"></a><br />SSL_SERVER_A_KEY</a>: <code>rsaEncryption</code></dt><dd></dd>
<dt><a id="SSL_SERVER_A_SIG"></a><br />SSL_SERVER_A_SIG</a>: <code>sha1WithRSAEncryption</code></dt><dd></dd>
<dt><a id="SSL_SERVER_CERT"></a><br />SSL_SERVER_CERT</a>: <code>-----BEGIN CERTIFICATE----- ... MIIFkTC ... -----END CERTIFICATE-----</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN"></a><br />SSL_SERVER_I_DN</a>: <code>/C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./OU=http://certificates.starfieldtech.com/repository/CN=Starfield Secure Certification Authority/serialNumber=10688435</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_C"></a><br />SSL_SERVER_I_DN_C</a>: <code>US</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_CN"></a><br />SSL_SERVER_I_DN_CN</a>: <code>Starfield Secure Certification Authority</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_L"></a><br />SSL_SERVER_I_DN_L</a>: <code>Scottsdale</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_O"></a><br />SSL_SERVER_I_DN_O</a>: <code>Starfield Technologies, Inc.</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_OU"></a><br />SSL_SERVER_I_DN_OU</a>: <code>http://certificates.starfieldtech.com/repository</code></dt><dd></dd>
<dt><a id="SSL_SERVER_I_DN_ST"></a><br />SSL_SERVER_I_DN_ST</a>: <code>Arizona</code></dt><dd></dd>
<dt><a id="SSL_SERVER_M_SERIAL"></a><br />SSL_SERVER_M_SERIAL</a>: <code>042840B88A2352</code></dt><dd></dd>
<dt><a id="SSL_SERVER_M_VERSION"></a><br />SSL_SERVER_M_VERSION</a>: <code>3</code></dt><dd></dd>
<dt><a id="SSL_SERVER_S_DN"></a><br />SSL_SERVER_S_DN</a>: <code>/O=www.askapache.com/OU=Domain Control Validated/CN=www.askapache.com</code></dt><dd></dd>
<dt><a id="SSL_SERVER_S_DN_CN"></a><br />SSL_SERVER_S_DN_CN</a>: <code>www.askapache.com</code></dt><dd></dd>
<dt><a id="SSL_SERVER_S_DN_O"></a><br />SSL_SERVER_S_DN_O</a>: <code>www.askapache.com</code></dt><dd></dd>
<dt><a id="SSL_SERVER_S_DN_OU"></a><br />SSL_SERVER_S_DN_OU</a>: <code>Domain Control Validated</code></dt><dd></dd>
<dt><a id="SSL_SERVER_V_END"></a><br />SSL_SERVER_V_END</a>: <code>Jul 14 16:53:43 2012 GMT</code></dt><dd></dd>
<dt><a id="SSL_SERVER_V_START"></a><br />SSL_SERVER_V_START</a>: <code>Jul 14 20:25:17 2010 GMT</code></dt><dd></dd>
<dt><a id="SSL_SESSION_ID"></a><br />SSL_SESSION_ID</a>: <code>4184083DD1C74547553018174950D88987BD7ED03CE54EBB6638539C34814376</code></dt><dd></dd>
<dt><a id="SSL_VERSION_INTERFACE"></a><br />SSL_VERSION_INTERFACE</a>: <code>mod_ssl/2.2.16</code></dt><dd></dd>
<dt><a id="SSL_VERSION_LIBRARY"></a><br />SSL_VERSION_LIBRARY</a>: <code>OpenSSL/0.9.8e-fips-rhel5</code></dt><dd></dd>
<dt><a id="THE_REQUEST"></a><br />THE_REQUEST</a>: <code>GET /pro/mod_rewrite/index.php?k=i HTTP/1.1</code></dt>
<dd><pre>RewriteCond %{THE_REQUEST} ^(GET|POST)\ /.*\?(s|search)=(.+)\ HTTP/ [NC]
RewriteRule .* http://www.askapache.com/search/%3/? [R=302,L,NE]</pre></dd>
<dt><a id="TIME"></a><br />TIME</a>: <code>20080915152142</code></dt>
<dd><pre>RewriteCond %{QUERY_STRING} showtime [NC]
RewriteCond T:%{TIME}_TY:%{TIME_YEAR}_TMO:%{TIME_MON}_TWD:%{TIME_WDAY}_TD:%{TIME_DAY}_TH:%{TIME_HOUR}_TMI:%{TIME_MIN}_TS:%{TIME_SEC} ^(.*)$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}?time=%1 [R,L]</pre></dd>
<dt><a id="TIME_DAY"></a><br />TIME_DAY</a>: <code>15</code></dt><dd></dd>
<dt><a id="TIME_HOUR"></a><br />TIME_HOUR</a>: <code>15</code></dt><dd></dd>
<dt><a id="TIME_MIN"></a><br />TIME_MIN</a>: <code>21</code></dt><dd></dd>
<dt><a id="TIME_MON"></a><br />TIME_MON</a>: <code>09</code></dt><dd></dd>
<dt><a id="TIME_SEC"></a><br />TIME_SEC</a>: <code>42</code></dt><dd></dd>
<dt><a id="TIME_WDAY"></a><br />TIME_WDAY</a>: <code>1</code></dt><dd></dd>
<dt><a id="TIME_YEAR"></a><br />TIME_YEAR</a>: <code>2008</code></dt><dd></dd>
<dt><a id="UNIQUE_ID"></a><br />UNIQUE_ID</a>: <code>qOr5tEBvcm8AAE-VoiUAAAAQ</code></dt><dd></dd>
</dl>

<p>This article is meant to prepare us for the advanced mod_rewrite examples that are soon to be published.  The upcoming article is going to be examples using <a href="http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html">mod_rewrite</a> to achieve some crazy stuff...  Here the focus is on identifying mod_rewrite variables and defining the limits of the module by checking the <a href='http://www.askapache.com/servers/mod_rewrite.c.html'>mod_rewrite source code</a>.<br class="C" /></p>


<p class="cnote">For a broader mod_rewrite cheat sheet, check this <a href="http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet/">printable</a> cheat sheet.</p>


<h2>Directives in Mod_Rewrite</h2>
<dl>
<dt>RewriteEngine</dt>
<dd><pre>RewriteEngine on|off</pre> On or Off to enable or disable (default) the whole rewriting engine</dd>
<dt>RewriteOptions</dt>
<dd><pre>RewriteOptions Options</pre> List of option strings to set</dd>

<dt>RewriteBase</dt>
<dd><pre>RewriteBase URL-path</pre> the base URL of the per-directory context
<dt>RewriteCond</dt>
<dd><pre>RewriteCond TestString CondPattern</pre> an input string and a to be applied regexp-pattern
<dt>RewriteRule</dt>
<dd><pre>RewriteRule Pattern Substitution [flags]</pre> an URL-applied regexp-pattern and a substitution URL
<dt>RewriteMap</dt>
<dd><pre>RewriteMap MapName MapType:MapSource</pre> a mapname and a filename
<dt>RewriteLock</dt>
<dd><pre>RewriteLock file-path</pre> the filename of a lockfile used for inter-process synchronization
<dt>RewriteLog</dt>
<dd><pre>RewriteLog file-path</pre> the filename of the rewriting logfile
<dt>RewriteLogLevel</dt>
<dd><pre>RewriteLogLevel Level</pre> the level of the rewriting logfile verbosity (0=none, 1=std, .., 9=max)
</dl>



<h2>RewriteRule Flags</h2>
<dl>
<dt><abbr title="Chain">C</abbr></dt>
<dd>Using the [Chain], or [C] flag, allows you to indicate that several rules should be chained together as a single logical transation. This is usually used when a transformation is sufficiently complicated to warrant breaking into several smaller steps.</dd>
<dt><abbr title="Cookie">CO</abbr></dt>
<dd><pre>cookie|CO=Name:Value:Domain[:Lifetime[:Path]]</pre><br />
This sets a cookie on the client's browser. The cookie's name is specified by NAME and the value is VAL. The domain field is the domain of the cookie, such as '.apache.org',the optional lifetime is the lifetime of the cookie in minutes, and the optional path is the path of the cookie.</dd>
<dt><abbr title="Env">E</abbr></dt>
<dd><pre>&#039;env|E=VAR:VAL&#039; (set environment variable)</pre><br />
RewriteRule (root|cmd)\.exe - [E=worm:nimda]
</dd>
<dt><abbr title="Forbidden">F</abbr></dt>
<dd><pre>&#039;forbidden|F&#039; (force URL to be forbidden)</pre><br /></dd>
<dt><abbr title="Gone">G</abbr></dt>
<dd><pre>&#039;gone|G&#039; (force URL to be gone)</pre><br /></dd>
<dt><abbr title="Handler">H</abbr></dt>
<dd><pre>&#039;handler|H=Content-handler&#039; (force Content handler)</pre><br /></dd>
<dt><abbr title="Last">L</abbr></dt>
<dd><pre>&#039;last|L&#039; (last rule)</pre><br /></dd>
<dt><abbr title="Next">N</abbr></dt>
<dd><pre>&#039;next|N&#039; (next round)</pre><br /></dd>
<dt><abbr title="No Case">NC</abbr></dt>
<dd><pre>&#039;nocase|NC&#039; (no case)</pre><br /></dd>
<dt><abbr title="No Escape">NE</abbr></dt>
<dd><pre>&#039;noescape|NE&#039; (no URI escaping of output)</pre><br /></dd>
<dt><abbr title="No Subrequest">NS</abbr></dt>
<dd><pre>&#039;nosubreq|NS&#039; (not for internal sub-requests)</pre><br /></dd>
<dt><abbr title="Proxy">P</abbr></dt>
<dd><pre>&#039;proxy|P&#039; (force proxy)</pre><br /></dd>
<dt><abbr title="pass through">PT</abbr></dt>
<dd><pre>&#039;passthrough|PT&#039; (pass through to next handler)</pre><br /></dd>
<dt><abbr title="Query String Append">QSA</abbr></dt>
<dd><pre>&#039;qsappend|QSA&#039; (query string append)</pre><br /></dd>
<dt><abbr title="Redirect">R</abbr></dt>
<dd><pre>&#039;redirect|R  [=code]&#039; (force redirect)</pre><br /></dd>
<dt><abbr title="Skip">S</abbr></dt>
<dd><pre>&#039;skip|S=num&#039; (skip next rule(s))</pre><br />

This flag forces the rewriting engine to skip the next num rules in sequence, if the current rule matches. Use this to make pseudo if-then-else constructs: The last rule of the then-clause becomes skip=N, where N is the number of rules in the else-clause. (This is not the same as the 'chain|C' flag!)</dd>
<dt><abbr title="Type">T</abbr></dt>
<dd><pre>&#039;type|T=MIME-type&#039; (force MIME type)</pre><br />
Force the MIME-type of the target file to be MIME-type. This can be used to set up the content-type based on some conditions. For example, the following snippet allows .php files to be displayed by mod_php if they are called with the .phps extension:
</dd>
</dl>


<h2>Rules and Conditions Processing Order</h2>
<ol>
<li>The Pattern of the RewriteRule (^/.*$) is checked first.</li>
<li>If the pattern matches, then the RewriteCond's are checked.</li>
<li>If the RewriteConditions also match, the RewriteRule is applied.</li>
</ol>



<h2>RewriteRule Special Variables</h2>
<ol>
<li><strong>ENV_</strong></li>
<li><strong>SSL_</strong></li>
<li><strong>HTTP_</strong></li>
<li><strong>LA-U_</strong></li>
<li><strong>LA-F_</strong></li>
</ol>


<h2>RewriteCond Tests</h2>
<ul>
<li><strong>f</strong> - FILE_EXISTS</li>
<li><strong>s</strong> - FILE_SIZE</li>
<li><strong>l</strong> - FILE_LINK</li>
<li><strong>d</strong> - FILE_DIR</li>
<li><strong>x</strong> - FILE_XBIT</li>
<li><strong>U</strong> - LU_URL</li>
<li><strong>F</strong> - LU_FILE</li>
<li><strong>&gt;</strong> - STR_GT</li>
<li><strong>&lt;</strong> - STR_LT</li>
<li><strong>=</strong> - STR_EQ</li>
</ul>



<h2>Special Rewrite Redirects</h2>
<ol>
<li>"permanent" - HTTP_MOVED_PERMANENTLY</li>
<li>"temp" - HTTP_MOVED_TEMPORARILY</li>
<li>"seeother" - HTTP_SEE_OTHER</li>
<li>digit</li>
</ol>


<h2>Recognized by Mod_Rewrite</h2>
<ol>
<li>ajp://</li>
<li>balancer://</li>
<li>ftp://</li>
<li>gopher://</li>
<li>http://</li>
<li>https://</li>
<li>ldap://</li>
<li>mailto:</li>
<li>news:</li>
<li>nntp://</li>
</ol>



<h2>Mod_Rewrite Variables, from Source</h2>
<ul>
<li>TIME - <code>%04d%02d%02d%02d%02d%02d</code></li>
<li>HTTPS - <code>flag ? "on" : "off"</code></li>
<li>TIME_DAY</li>
<li>TIME_SEC</li>
<li>TIME_MIN</li>
<li>TIME_HOUR</li>
<li>TIME_MON</li>
<li>TIME_WDAY</li>
<li>TIME_YEAR</li>
<li>IS_SUBREQ - <code> (main ? "true" : "false");</code></li>
<li>PATH_INFO - <code> path_info;</code></li>
<li>AUTH_TYPE - <code> ap_auth_type;</code></li>
<li>HTTP_HOST - <code> lookup_header("Host", ctx);</code></li>
<li>SERVER_NAME - <code> ap_get_server_name(r);</code></li>
<li>REMOTE_ADDR - <code> connection-&gt;remote_ip;</code></li>
<li>SERVER_ADDR - <code> connection-&gt;local_ip;</code></li>
<li>HTTP_ACCEPT - <code> lookup_header("Accept", ctx);</code></li>
<li>THE_REQUEST - <code> the_request;</code></li>
<li>API_VERSION - <code> "%d:%d",MODULE_MAGIC_NUMBER_MAJOR,MODULE_MAGIC_NUMBER_MINOR);</code></li>
<li>HTTP_COOKIE - <code> lookup_header("Cookie", ctx);</code></li>
<li>SERVER_PORT - <code> ap_get_server_port(r);</code></li>
<li>REMOTE_HOST</li>
<li>REMOTE_NAME, NULL);</code></li>
<li>REMOTE_PORT - <code> r-&gt;connection-&gt;remote_addr-&gt;port</code></li>
<li>REMOTE_USER - <code> user;</code></li>
<li>SCRIPT_USER - <code> "&lt;unknown&gt;";</code></li>
<li>APR_FINFO_USER</li>
<li>REQUEST_URI - <code> uri;</code></li>
<li>SCRIPT_GROUP - <code> "&lt;unknown&gt;";</code></li>
<li>REMOTE_IDENT - <code> ap_get_remote_logname(r);</code></li>
<li>HTTP_REFERER - <code> lookup_header("Referer", ctx);</code></li>
<li>QUERY_STRING - <code> args;</code></li>
<li>SERVER_ADMIN - <code> server-&gt;server_admin;</code></li>
<li>DOCUMENT_ROOT - <code> ap_document_root(r);</code></li>
<li>HTTP_FORWARDED - <code>lookup_header("Forwarded", ctx);</code></li>
<li>REQUEST_METHOD - <code>method;</code></li>
<li>HTTP_USER_AGENT - <code>lookup_header("User-Agent", ctx);</code></li>
<li>SCRIPT_FILENAME - <code> same as request_filename </code></li>
<li>REQUEST_FILENAME - <code> same as script_filename </code></li>
<li>SERVER_PROTOCOL - <code>protocol</code></li>
<li>SERVER_SOFTWARE - <code>ap_get_server_banner();</code></li>
<li>HTTP_PROXY_CONNECTION - <code>lookup_header("Proxy-Connection", ctx);</code></li>
</ul>


<h2>REGEX Rewrite Guides</h2>
<ul>
<li><a href="http://www.rankinglabs.com/Mod_Rewrite">Mod_Rewrite: Flags, Rules, Conditions, Tutorial and Variables</a></li>
<li><a href="http://etext.lib.virginia.edu/services/helpsheets/unix/regex.html" title="Stephen Ramsay - Electronic Text Center - University of Virginia ">Using Regular Expressions</a></li>
<li><a href="http://check-these.info/mod_rewrite-basic.html">RewriteRule (mod_rewrite) guide</a></li>
</ul>


<h2>Mod_Rewrite Terms and Definitions</h2>
<dl>
<dt>pattern</dt><dd>the RegExp pattern string</dd>
<dt>regexp<dt><dd>the RegExp pattern compilation</dd>
<dt>flags</dt>
<dd>Flags which control the substitution</dd>
<dt>forced_mimetype</dt>
<dd>forced MIME type of substitution</dd>
<dt>forced_handler</dt>
<dd>forced content handler of subst.</dd>
<dt>forced_responsecode</dt>
<dd>forced HTTP response status</dd>
<dt>env</dt>
<dd>added environment variables</dd>
<dt>cookie</dt>
<dd>added cookies</dd>
<dt>skip</dt>
<dd>number of next rules to skip</dd>
<dt>state</dt>
<dd>the RewriteEngine state</dd>
<dt>options</dt>
<dd>the RewriteOption state</dd>
<dt>rewritelogfile</dt>
<dd>the RewriteLog filename</dd>
<dt>rewritelogfp</dt>
<dd>the RewriteLog open filepointer</dd>
<dt>rewritelog:  level</dt>
<dd>the RewriteLog level of verbosity</dd>
<dt>rewritemaps</dt>
<dd>the RewriteMap entries</dd>
<dt>rewriteconds</dt>
<dd>the RewriteCond entries (temp.)</dd>
<dt>rewriterules</dt>
<dd>the RewriteRule entries</dd>
<dt>directory</dt>
<dd>the directory where it applies</dd>
<dt>baseurl</dt>
<dd>the base-URL  where it applies</dd>
</dl>


<h2>Mod_Rewrite Errors</h2>
<ul style="font-size:10px;">
<li><code>Options FollowSymLinks or SymLinksIfOwnerMatch is off  which implies that RewriteRule directive is forbidden:  %s</code></li>
<li><code>RewriteCond: bad argument line </code></li>
<li><code>RewriteCond: NoCase option for non-regex pattern %s  is not supported and will be ignored.</code></li>
<li><code>RewriteCond: cannot compile regular  expression </code></li>
<li><code>RewriteRule: invalid HTTP  response code %s for  flag R</code></li>
<li><code>RewriteRule: unknown flag </code></li>
<li><code>RewriteRule: cannot compile regular expression </code></li>
<li><code>RewriteOptions: MaxRedirects option has been  removed in favor of the global  LimitInternalRecursion directive and will be  ignored.</code></li>
<li><code>RewriteOptions: unknown option </code></li>
<li><code>RewriteMap: bad path to txt map: </code></li>
<li><code>RewriteMap: bad path to rnd map: </code></li>
<li><code>RewriteMap: bad map:</code></li>
<li><code>RewriteMap: bad path to dbm map: </code></li>
<li><code>RewriteMap: dbm type </code></li>
<li><code>RewriteMap: bad path to prg map: </code></li>
<li><code>RewriteMap: internal map not found:</code></li>
<li><code>RewriteMap: bad path to txt map: </code></li>
<li><code>RewriteMap: file for map not found:</code></li>
<li><code>Invalid RewriteLock path</code></li>
<li><code>RewriteBase: only valid in per-directory config files</code></li>
<li><code>RewriteBase: empty URL not allowed</code></li>
<li><code>RewriteBase: argument is not a valid URL</code></li>
<li><code>RewriteCond: bad flag delimiters</code></li>
<li><code>RewriteCond: unknown flag</code></li>
<li><code>RewriteLog and RewriteLogLevel are not supported by this build of mod_rewrite because it was compiled using the -DREWRITELOG_DISABLED compiler option. You have to recompile mod_rewrite WITHOUT this option in order to use the rewrite log.</code></li>
<li><code>mod_rewrite: Invalid RewriteLog  path %s</code></li>
<li><code>mod_rewrite: could not open reliable pipe  to RewriteLog filter %s</code></li>
<li><code>mod_rewrite: Invalid RewriteLog  path %s</code></li>
<li><code>mod_rewrite: could not open RewriteLog  file %s</code></li>
<li><code>mod_rewrite: Running external rewrite maps  without defining a RewriteLock is DANGEROUS!</code></li>
<li><code>mod_rewrite: could not start RewriteMap  program %s</code></li>
<li><code>mod_rewrite: cant access text RewriteMap file %s</code></li>
<li><code>mod_rewrite: cant access DBM RewriteMap file %s</code></li>
<li><code>mod_rewrite: Parent could not create RewriteLock  file %s</code></li>
<li><code>mod_rewrite: Parent could not set permissions  on RewriteLock check User and Group directives</code></li>
<li><code>mod_rewrite: could not create rewrite_log_lock</code></li>
<li><code>mod_rewrite: Could not set permissions on  rewrite_log_lock check User and Group directives</code></li>
<li><code>mod_rewrite: could not init rewrite_mapr_lock_acquire  in child</code></li>
<li><code>mod_rewrite: could not init rewrite log lock in child</code></li>
<li><code>mod_rewrite: could not init map cache in child</code></li>
<li><code>split uri=%s -&gt; uri=%s, args=%s</code></li>
<li><code>reduce %s -&gt; %s</code></li>
<li><code>strip matching prefix: %s -&gt; %s</code></li>
<li><code>add subst prefix: %s -&gt; %s</code></li>
<li><code>cant open RewriteMap file, see error log</code></li>
<li><code>cache lookup FAILED, forcing new map lookup</code></li>
<li><code>map lookup FAILED: map=%s[txt] key=%s</code></li>
<li><code>map lookup OK: map=%s[txt] key=%s -&gt; val=%s</code></li>
<li><code>cache lookup OK: map=%s[txt] key=%s -&gt; val=%s</code></li>
<li><code>randomly chosen the subvalue `%s</code></li>
<li><code>cant open DBM RewriteMap file, see error log</code></li>
<li><code>cache lookup FAILED, forcing new map lookup</code></li>
<li><code>map lookup FAILED: map=%s[dbm] key=%s</code></li>
<li><code>map lookup OK: map=%s[dbm] key=%s -&gt;  val=%s</code></li>
<li><code>cache lookup OK: map=%s[dbm] key=%s -&gt; val=%s</code></li>
<li><code>map lookup FAILED: map=%s key=%s</code></li>
<li><code>map lookup OK: map=%s key=%s -&gt; val=%s</code></li>
<li><code>map lookup FAILED: map=%s key=%s</code></li>
<li><code>map lookup OK: map=%s key=%s -&gt; val=%s</code></li>
<li><code>lookahead: path=%s var=%s  -&gt; val=%s</code></li>
<li><code>lookahead: path=%s var=%s  -&gt; val=%s</code></li>
<li><code>RESULT=%s</code></li>
<li><code>escaping backreference %s to %s</code></li>
<li><code>setting env variable %s to %s</code></li>
<li><code>setting cookie %s, cookie</code></li>
<li><code>skipping already set cookie %s</code></li>
<li><code>RewriteCond URI (-U) check:  path=%s -&gt; status=%d</code></li>
<li><code>RewriteCond file (-F) check: path=%s  -&gt; file=%s status=%d</code></li>
<li><code>RewriteCond: input=%s pattern=%s%s%s%s  =&gt; %s</code></li>
<li><code>remember %s to have MIME-type  %s</code></li>
<li><code>remember %s to have  Content-handler %s</code></li>
<li><code>add path info postfix: %s -&gt; %s%s</code></li>
<li><code>strip per-dir prefix: %s -&gt; %s</code></li>
<li><code>applying pattern %s to uri %s</code></li>
<li><code>rewrite %s -&gt; %s, ctx-&gt;uri</code></li>
<li><code>forcing responsecode %d for %s</code></li>
<li><code>add per-dir prefix: %s -&gt; %s%s</code></li>
<li><code>forcing proxy-throughput with %s</code></li>
<li><code>explicitly forcing redirect with %s</code></li>
<li><code>implicitly forcing redirect (rc=%d)  with %s</code></li>
<li><code>forcing %s to get passed through  to next API URI-to-filename handler</code></li>
<li><code>init rewrite engine with requested uri %s</code></li>
<li><code>go-ahead with proxy request  %s [OK]</code></li>
<li><code>dconf-&gt;directory,trying to replace prefix %s with %s</code></li>
<li><code>escaping %s for redirect</code></li>
<li><code>redirect to %s [REDIRECT/%d]</code></li>
<li><code>initial URL equal rewritten  URL: %s [IGNORING REWRITE]</code></li>
<li><code>dconf-&gt;directory, trying to replace prefix  %s with %s</code></li>
<li><code>strip document_root  prefix: %s -&gt; %s</code></li>
<li><code>internal redirect with %s  [INTERNAL REDIRECT]</code></li>
<li><code>pass through %s</code></li>
<li><code>force filename %s to have MIME-type %s</code></li>
<li><code>force filename %s to have the  Content-handler %s,</code></li>
<li><code>init rewrite engine with requested uri %s</code></li>
<li><code>init rewrite engine with passed filename  %s. Original uri = %s</code></li>
<li><code>uri already rewritten. Status %s, Uri %s,   %s</code></li>
<li><code>attempt to make remote request from mod_rewrite  without proxy enabled: %s</code></li>
<li><code>go-ahead with proxy request %s [OK]</code></li>
<li><code>escaping %s for redirect</code></li>
<li><code>redirect to %s [REDIRECT/%d]</code></li>
<li><code>local path result: %s</code></li>
<li><code>prefixing with document_root of %s  FAILED</code></li>
<li><code>prefixed with document_root to %s</code></li>
<li><code>go-ahead with %s [OK]</code></li>
<li><code>pass through %s</code></li>
</ul>



<h2>URL Rewriting Module</h2>
<blockquote cite="http://apache.askapache.com/httpd/httpd-2.2.8/modules/mappers/mod_rewrite.c">
<p>This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly.</p>
<p>It supports an unlimited number of additional rule conditions (which can operate on a lot of variables, even on HTTP headers) for granular matching and even external database lookups (either via plain text tables, DBM hash files or even external processes) for advanced URL substitution.</p>
<p>It operates on the full URLs (including the PATH_INFO part) both in per-server context (httpd.conf) and per-dir context (.htaccess) and even  can generate QUERY_STRING parts on result.  The rewriting result finally can lead to internal subprocessing, external request redirection or even to internal proxy throughput.</p>
<p>This module was originally written in April 1996 and gifted exclusively to the The Apache Software Foundation in July 1997 by</p>
<address class="vcard">
<a class="fn url" href="http://engelschall.com/" title="Ralf S. Engelschall">Ralf S. Engelschall</a>
<a class="fn email" href="http://engelschall.com/contact.php">rse [at] engenschall.com</a>
</address>
</blockquote>
<p><a href="http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html"></a><a href="http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html">Mod_Rewrite Variables Cheatsheet</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Actual Htaccess Files from My Server</title>
		<link>http://www.askapache.com/htaccess/real-world-htaccess-files.html</link>
		<comments>http://www.askapache.com/htaccess/real-world-htaccess-files.html#comments</comments>
		<pubDate>Sat, 17 Apr 2010 15:06:22 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Htaccess]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=4357</guid>
		<description><![CDATA[<pre>#### No https except to wp-admin -
# If the request is empty ( implies fopen or normal file access by a php script )
RewriteCond %{THE_REQUEST} ^$ [OR]
&#160;
# OR if the request if for wp-admin or wp-login.php
RewriteCond %{REQUEST_URI} ^/(wp-admin&#124;wp-login\.php).*$ [NC,OR]
&#160;
# OR if the Referer is https
RewriteCond %{HTTP_REFERER} ^https://www.askapache.com/.*$ [NC]
&#160;
# THEN skip the following rule, basically all this does is force https or badhost to be redirected
# BUT because of the above 3 rewritecond&#039;s, this won&#039;t break poorly written admin scripts
RewriteRule .* - [S=1]
&#160;
RewriteCond %{HTTPS} =on [OR]
RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC]
RewriteRule .* http://www.askapache.com%{REQUEST_URI} [R=301,L]
&#160;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(wp-admin/.*&#124;wp-login\.php.*)\ HTTP/ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]</pre>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/htaccess/real-world-htaccess-files.html"></a><a href="http://www.askapache.com/htaccess/real-world-htaccess-files.html"><cite>AskApache.com</cite></a></p><p>I was going through some backups from years ago, and ran:</p>
<pre>locate .htaccess | xargs -I&#039;{}&#039; cat &#039;{}&#039; &gt;&gt; master-htaccesser.txt</pre>
<p>My site is named after reading source code because that is what helps me the most when I'm trying to learn something unusually difficult.   Just like functions and aliases, it is very helpful to have cheatsheets for common commands.. not much is better than real-world examples.  Unfortunately because this was compiled from hundreds of htaccess files on multiple hosts and platforms, and due to the concatenation, it's not organized.</p>

<p>Normally I would not publish something like this, who knows how much unreleased tricks I forgot about..  but in order to say thanks to all those working for open-source, the FSF, and to all those who don't steal content, and to all the incredible authors who shared with me (I twitter most of what I find, and follow my favs), here ya go..</p>


<p class="cnote"><strong>ATTN:</strong> Please let me know if this is total junk or not, this is around 1/500th of my master-htaccesser.txt file.. and I'd be happy to post more if it helps..</p>

<h2>Checking for Cookie</h2>
<p>Used this to stop mp3-scrapers.. checks for a cookie ending in MP3P=02357</p>
<pre>Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_COOKIE} !^.*MP3P=([0-9]+).* [NC]
RewriteRule .* - [F,L]</pre>

<h2>Setting Environment Var if Proxied</h2>
<pre>RewriteEngine On
RewriteRule "\.(gif|png|jpg)$" "-" [ENV=proxied_image:1]
RewriteCond "%{ENV:proxied_image}" "!1"
RewriteRule "^" "-" [ENV=proxied_other:1]</pre>

<h2>nokeepalive for ErrorDocs and Abusers</h2>
<pre>Options SymLinksIfOwnerMatch IncludesNOEXEC
AddOutputFilter Includes html
SetEnv nokeepalive
Order Allow,Deny
Allow from all
# 1 YEAR
&lt;filesMatch "\.(js|css)$"&gt;
Header unset Pragma
FileETag None
Header set Cache-Control "public"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
Header unset Last-Modified
Header unset Last-Modified
Header unset ETag
&nbsp;
SetOutputFilter DEFLATE
Header set Cache-Control "public"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
&lt;/filesMatch&gt;
SecFilterEngine Off
&nbsp;
# 1 YEAR
&lt;filesMatch "\.(js|css)$"&gt;
Header unset Pragma
FileETag None
Header set Cache-Control "public"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
Header unset Last-Modified
Header unset Last-Modified
Header unset ETag
&nbsp;
SetOutputFilter DEFLATE
Header set Cache-Control "public"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
&lt;/filesMatch&gt;</pre>








<h2>Unreleased Tests for AskApache Password Protection</h2>
<pre># +ASKAPACHE PASSPRO 4.6.6
#######################################################
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# +APRO SIDS
# +SID 21030002
Order Deny,Allow
Deny from All
Satisfy Any
AuthType Digest
AuthName "Protected By AskApache"
AuthDigestDomain / http://www.askapache.com/
AuthDigestFile /home/.greer/askapache/sites/askapache.com/.htpasswda3
Require valid-user
&lt;filesMatch "\.(ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js)$"&gt;
Allow from All
&lt;/filesMatch&gt;
&lt;filesMatch "(async-upload|admin-ajax)\.php$"&gt;
&lt;ifModule mod_security.c&gt;
SecFilterEngine Off
&lt;/ifModule&gt;
Allow from All
&lt;/filesMatch&gt;
# -SID 21030002
# -APRO SIDS
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
#######################################################
# -ASKAPACHE PASSPRO 4.6.6
&nbsp;
# +ASKAPACHE PASSPRO 4.6.6
#######################################################
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# +APRO SIDS
# +SID Test
ErrorDocument 401 /wp-content/askapache/test.gif
ErrorDocument 403 /wp-content/askapache/test.gif
ErrorDocument 404 /wp-content/askapache/test.gif
ErrorDocument 500 /wp-content/askapache/test.gif
ServerSignature On
&lt;ifModule mod_alias.c&gt;
RedirectMatch 305 ^.*modaliastest$ http://www.askapache.com
&lt;/ifModule&gt;
&lt;ifModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} modrewritetest [NC]
RewriteRule .* http://www.askapache.com [R=307,L]
&lt;/ifModule&gt;
&lt;files modsec_check.gif&gt;
&lt;ifModule mod_security.c&gt;
SetEnv MODSEC_ENABLE On
SecFilterEngine On
SecFilterDefaultAction "nolog,noauditlog,pass"
SecAuditEngine Off
SecFilterInheritance Off
SecFilter modsecuritytest "deny,nolog,noauditlog,status:503"
Deny from All
&lt;/ifModule&gt;
&lt;/files&gt;
&lt;files basic_auth_test.gif&gt;
AuthType Basic
AuthName "askapache test"
AuthUserFile /home/.greer/askapache/sites/askapache.com/htdocs/wp-content/askapache/.htpasswd-basic
Require valid-user
&lt;/files&gt;
&lt;files digest_check.gif&gt;
AuthType Digest
AuthName "askapache test"
AuthDigestDomain /wp-content/askapache/ http://www.askapache.com/wp-content/askapache/
AuthUserFile /home/.greer/askapache/sites/askapache.com/htdocs/wp-content/askapache/.htpasswd-digest
Require none
&lt;/files&gt;
&lt;files authuserfile_test.gif&gt;
AuthType Digest
AuthName "askapache test"
AuthDigestDomain /wp-content/askapache/ http://www.askapache.com/wp-content/askapache/
AuthUserFile /home/.greer/askapache/sites/askapache.com/htdocs/wp-content/askapache/.htpasswd-digest
Require valid-user
&lt;/files&gt;
&lt;files authdigestfile_test.gif&gt;
AuthType Digest
AuthName "askapache test"
AuthDigestDomain /wp-content/askapache/ http://www.askapache.com/wp-content/askapache/
AuthDigestFile /home/.greer/askapache/sites/askapache.com/htdocs/wp-content/askapache/.htpasswd-digest
Require valid-user
&lt;/files&gt;
# -SID Test
# -APRO SIDS
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
#######################################################
# -ASKAPACHE PASSPRO 4.6.6</pre>
















<h2>Warming up to the really advanced tests</h2>
<pre>Options +ExecCGI
Order Deny,Allow
Deny from All
Allow from 208.113.134.190 64.111.114.111 208.113.134.203 208.113.152.201 env=REDIRECT_STATUS
Satisfy Any
Options +FollowSymLinks
AddHandler application/x-httpd-php .php
&nbsp;
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !^tyy+$ [NC]
RewriteCond %{REMOTE_USER} ^(.+)$
RewriteRule ^(.*)$ $1/-%1 [R=302,L]
Options +ExecCGI +FollowSymLinks
DirectoryIndex index.php
ErrorDocument 404 /cgi-bin/pro/index.php
&nbsp;
AuthType Digest
AuthName "AskApache Pro"
AuthDigestFile /home/askapache/sites/askapache.com/.htpasswd-pro
AuthDigestDomain /cgi-bin/pro/ http://www.askapache.com/cgi-bin/pro/ https://www.askapache.com/cgi-bin/pro/
Require user askapacheDirectoryIndex p.php
ErrorDocument 403 /cgi-bin/p/p.php
ErrorDocument 401 /cgi-bin/p/p.php
ErrorDocument 500 /cgi-bin/p/p.php
ErrorDocument 503 /cgi-bin/p/p.php
&nbsp;
RewriteEngine On
RewriteBase /
RewriteRule .* - [E=INFO_API_VERSION:%{API_VERSION}]
RewriteRule .* - [E=INFO_AUTH_TYPE:%{AUTH_TYPE}]
RewriteRule .* - [E=INFO_CONTENT_LENGTH:%{CONTENT_LENGTH}]
RewriteRule .* - [E=INFO_CONTENT_TYPE:%{CONTENT_TYPE}]
RewriteRule .* - [E=INFO_DOCUMENT_ROOT:%{DOCUMENT_ROOT}]
RewriteRule .* - [E=INFO_GATEWAY_INTERFACE:%{GATEWAY_INTERFACE}]
RewriteRule .* - [E=INFO_HTTPS:%{HTTPS}]
RewriteRule .* - [E=INFO_HTTP_ACCEPT:%{HTTP:Accept}]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_LANGUAGE:%{HTTP:Accept-Language}]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_ENCODING:%{HTTP:Accept-Encoding}]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_CHARSET:%{HTTP:Accept-Charset}]
RewriteRule .* - [E=INFO_HTTP_CACHE_CONTROL:%{HTTP:Cache-Control}]
RewriteRule .* - [E=INFO_HTTP_CONNECTION:%{HTTP:Connection}]
RewriteRule .* - [E=INFO_HTTP_COOKIE:%{HTTP_COOKIE}]
RewriteRule .* - [E=INFO_HTTP_FORWARDED:%{HTTP_FORWARDED}]
RewriteRule .* - [E=INFO_HTTP_HOST:%{HTTP_HOST}]
RewriteRule .* - [E=INFO_HTTP_KEEP_ALIVE:%{HTTP_KEEP_ALIVE}]
RewriteRule .* - [E=INFO_HTTP_PROXY_CONNECTION:%{HTTP_PROXY_CONNECTION}]
RewriteRule .* - [E=INFO_HTTP_REFERER:%{HTTP:Referer}]
RewriteRule .* - [E=INFO_HTTP_USER_AGENT:%{HTTP_USER_AGENT}]
RewriteRule .* - [E=INFO_IS_SUBREQ:%{IS_SUBREQ}]
RewriteRule .* - [E=INFO_ORIG_PATH_INFO:%{ORIG_PATH_INFO}]
RewriteRule .* - [E=INFO_ORIG_PATH_TRANSLATED:%{ORIG_PATH_TRANSLATED}]
RewriteRule .* - [E=INFO_ORIG_SCRIPT_FILENAME:%{ORIG_SCRIPT_FILENAME}]
RewriteRule .* - [E=INFO_ORIG_SCRIPT_NAME:%{ORIG_SCRIPT_NAME}]
RewriteRule .* - [E=INFO_PATH:%{PATH}]
RewriteRule .* - [E=INFO_PATH_INFO:%{PATH_INFO}]
RewriteRule .* - [E=INFO_QUERY_STRING:%{QUERY_STRING}]
RewriteRule .* - [E=INFO_REDIRECT_QUERY_STRING:%{REDIRECT_QUERY_STRING}]
RewriteRule .* - [E=INFO_REDIRECT_REMOTE_USER:%{REDIRECT_REMOTE_USER}]
RewriteRule .* - [E=INFO_REDIRECT_STATUS:%{REDIRECT_STATUS}]
RewriteRule .* - [E=INFO_REDIRECT_URL:%{REDIRECT_URL}]
RewriteRule .* - [E=INFO_REMOTE_ADDR:%{REMOTE_ADDR}]
RewriteRule .* - [E=INFO_REMOTE_HOST:%{REMOTE_HOST}]
RewriteRule .* - [E=INFO_REMOTE_IDENT:%{REMOTE_IDENT}]
RewriteRule .* - [E=INFO_REMOTE_PORT:%{REMOTE_PORT}]
RewriteRule .* - [E=INFO_REMOTE_USER:%{REMOTE_USER}]
RewriteRule .* - [E=INFO_REQUEST_FILENAME:%{REQUEST_FILENAME}]
RewriteRule .* - [E=INFO_REQUEST_METHOD:%{REQUEST_METHOD}]
RewriteRule .* - [E=INFO_REQUEST_URI:%{REQUEST_URI}]
RewriteRule .* - [E=INFO_REDIRECT_REQUEST_URI:%{REDIRECT_REQUEST_URI}]
RewriteRule .* - [E=INFO_SCRIPT_FILENAME:%{SCRIPT_FILENAME}]
RewriteRule .* - [E=INFO_SCRIPT_GROUP:%{SCRIPT_GROUP}]
RewriteRule .* - [E=INFO_SCRIPT_NAME:%{SCRIPT_NAME}]
RewriteRule .* - [E=INFO_SCRIPT_URI:%{SCRIPT_URI}]
RewriteRule .* - [E=INFO_SCRIPT_URL:%{SCRIPT_URL}]
RewriteRule .* - [E=INFO_SCRIPT_USER:%{SCRIPT_USER}]
RewriteRule .* - [E=INFO_SERVER_ADDR:%{SERVER_ADDR}]
RewriteRule .* - [E=INFO_SERVER_ADMIN:%{SERVER_ADMIN}]
RewriteRule .* - [E=INFO_SERVER_NAME:%{SERVER_NAME}]
RewriteRule .* - [E=INFO_SERVER_PORT:%{SERVER_PORT}]
RewriteRule .* - [E=INFO_SERVER_PROTOCOL:%{SERVER_PROTOCOL}]
RewriteRule .* - [E=INFO_SERVER_SIGNATURE:%{SERVER_SIGNATURE}]
RewriteRule .* - [E=INFO_SERVER_SOFTWARE:%{SERVER_SOFTWARE}]
RewriteRule .* - [E=INFO_THE_REQUEST:%{THE_REQUEST}]
RewriteRule .* - [E=INFO_TIME:%{TIME}]
RewriteRule .* - [E=INFO_TIME_DAY:%{TIME_DAY}]
RewriteRule .* - [E=INFO_TIME_HOUR:%{TIME_HOUR}]
RewriteRule .* - [E=INFO_TIME_MIN:%{TIME_MIN}]
RewriteRule .* - [E=INFO_TIME_MON:%{TIME_MON}]
RewriteRule .* - [E=INFO_TIME_SEC:%{TIME_SEC}]
RewriteRule .* - [E=INFO_TIME_WDAY:%{TIME_WDAY}]
RewriteRule .* - [E=INFO_TIME_YEAR:%{TIME_YEAR}]
RewriteRule .* - [E=INFO_TZ:%{TZ}]
RewriteRule .* - [E=INFO_UNIQUE_ID:%{UNIQUE_ID}]
&nbsp;
RequestHeader set INFO_API_VERSION "%{INFO_API_VERSION}e"
RequestHeader set INFO_AUTH_TYPE "%{INFO_AUTH_TYPE}e"
RequestHeader set INFO_CONTENT_LENGTH "%{INFO_CONTENT_LENGTH}e"
RequestHeader set INFO_CONTENT_TYPE "%{INFO_CONTENT_TYPE}e"
RequestHeader set INFO_DOCUMENT_ROOT "%{INFO_DOCUMENT_ROOT}e"
RequestHeader set INFO_GATEWAY_INTERFACE "%{INFO_GATEWAY_INTERFACE}e"
RequestHeader set INFO_HTTPS "%{INFO_HTTPS}e"
RequestHeader set INFO_HTTP_ACCEPT "%{INFO_HTTP_ACCEPT}e"
RequestHeader set INFO_HTTP_ACCEPT_LANGUAGE "%{INFO_HTTP_ACCEPT_LANGUAGE}e"
RequestHeader set INFO_HTTP_ACCEPT_ENCODING "%{INFO_HTTP_ACCEPT_ENCODING}e"
RequestHeader set INFO_HTTP_ACCEPT_CHARSET "%{INFO_HTTP_ACCEPT_CHARSET}e"
RequestHeader set INFO_HTTP_CACHE_CONTROL "%{INFO_HTTP_CACHE_CONTROL}e"
RequestHeader set INFO_HTTP_CONNECTION "%{INFO_HTTP_CONNECTION}e"
RequestHeader set INFO_HTTP_COOKIE "%{INFO_HTTP_COOKIE}e"
RequestHeader set INFO_HTTP_FORWARDED "%{INFO_HTTP_FORWARDED}e"
RequestHeader set INFO_HTTP_HOST "%{INFO_HTTP_HOST}e"
RequestHeader set INFO_HTTP_KEEP_ALIVE "%{INFO_HTTP_KEEP_ALIVE}e"
RequestHeader set INFO_HTTP_PROXY_CONNECTION "%{INFO_HTTP_PROXY_CONNECTION}e"
RequestHeader set INFO_HTTP_REFERER "%{INFO_HTTP_REFERER}e"
RequestHeader set INFO_HTTP_USER_AGENT "%{INFO_HTTP_USER_AGENT}e"
RequestHeader set INFO_IS_SUBREQ "%{INFO_IS_SUBREQ}e"
RequestHeader set INFO_ORIG_PATH_INFO "%{INFO_ORIG_PATH_INFO}e"
RequestHeader set INFO_ORIG_PATH_TRANSLATED "%{INFO_ORIG_PATH_TRANSLATED}e"
RequestHeader set INFO_ORIG_SCRIPT_FILENAME "%{INFO_ORIG_SCRIPT_FILENAME}e"
RequestHeader set INFO_ORIG_SCRIPT_NAME "%{INFO_ORIG_SCRIPT_NAME}e"
RequestHeader set INFO_PATH "%{INFO_PATH}e"
RequestHeader set INFO_PATH_INFO "%{INFO_PATH_INFO}e"
RequestHeader set INFO_QUERY_STRING "%{INFO_QUERY_STRING}e"
RequestHeader set INFO_REDIRECT_QUERY_STRING "%{INFO_REDIRECT_QUERY_STRING}e"
RequestHeader set INFO_REDIRECT_REMOTE_USER "%{INFO_REDIRECT_REMOTE_USER}e"
RequestHeader set INFO_REDIRECT_STATUS "%{INFO_REDIRECT_STATUS}e"
RequestHeader set INFO_REDIRECT_URL "%{INFO_REDIRECT_URL}e"
RequestHeader set INFO_REMOTE_ADDR "%{INFO_REMOTE_ADDR}e"
RequestHeader set INFO_REMOTE_HOST "%{INFO_REMOTE_HOST}e"
RequestHeader set INFO_REMOTE_IDENT "%{INFO_REMOTE_IDENT}e"
RequestHeader set INFO_REMOTE_PORT "%{INFO_REMOTE_PORT}e"
RequestHeader set INFO_REMOTE_USER "%{INFO_REMOTE_USER}e"
RequestHeader set INFO_REQUEST_FILENAME "%{INFO_REQUEST_FILENAME}e"
RequestHeader set INFO_REQUEST_METHOD "%{INFO_REQUEST_METHOD}e"
RequestHeader set INFO_REQUEST_URI "%{INFO_REQUEST_URI}e"
RequestHeader set INFO_REQUEST_URI "%{INFO_REQUEST_URI}e"
RequestHeader set INFO_SCRIPT_FILENAME "%{INFO_SCRIPT_FILENAME}e"
RequestHeader set INFO_SCRIPT_GROUP "%{INFO_SCRIPT_GROUP}e"
RequestHeader set INFO_SCRIPT_NAME "%{INFO_SCRIPT_NAME}e"
RequestHeader set INFO_SCRIPT_URI "%{INFO_SCRIPT_URI}e"
RequestHeader set INFO_SCRIPT_URL "%{INFO_SCRIPT_URL}e"
RequestHeader set INFO_SCRIPT_USER "%{INFO_SCRIPT_USER}e"
RequestHeader set INFO_SERVER_ADDR "%{INFO_SERVER_ADDR}e"
RequestHeader set INFO_SERVER_ADMIN "%{INFO_SERVER_ADMIN}e"
RequestHeader set INFO_SERVER_NAME "%{INFO_SERVER_NAME}e"
RequestHeader set INFO_SERVER_PORT "%{INFO_SERVER_PORT}e"
RequestHeader set INFO_SERVER_PROTOCOL "%{INFO_SERVER_PROTOCOL}e"
RequestHeader set INFO_SERVER_SIGNATURE "%{INFO_SERVER_SIGNATURE}e"
RequestHeader set INFO_SERVER_SOFTWARE "%{INFO_SERVER_SOFTWARE}e"
RequestHeader set INFO_THE_REQUEST "%{INFO_THE_REQUEST}e"
RequestHeader set INFO_TIME "%{INFO_TIME}e"
RequestHeader set INFO_TIME_DAY "%{INFO_TIME_DAY}e"
RequestHeader set INFO_TIME_HOUR "%{INFO_TIME_HOUR}e"
RequestHeader set INFO_TIME_MIN "%{INFO_TIME_MIN}e"
RequestHeader set INFO_TIME_MON "%{INFO_TIME_MON}e"
RequestHeader set INFO_TIME_SEC "%{INFO_TIME_SEC}e"
RequestHeader set INFO_TIME_WDAY "%{INFO_TIME_WDAY}e"
RequestHeader set INFO_TIME_YEAR "%{INFO_TIME_YEAR}e"
RequestHeader set INFO_TZ "%{INFO_TZ}e"
RequestHeader set INFO_UNIQUE_ID "%{INFO_UNIQUE_ID}e"
&nbsp;
Options +FollowSymLinks +ExecCGI
DirectoryIndex /cgi-bin/rewrite-test/index.php
&nbsp;
Header echo ^.*
&nbsp;
AuthType Digest
AuthName "AskApache Pro"
AuthDigestFile /home/askapache/sites/askapache.com/.htpasswd-pro
AuthDigestDomain / http://www.askapache.com/cgi-bin/rewrite-test/ https://www.askapache.com/cgi-bin/rewrite-test/
Require user askapache
&nbsp;
SetEnv MODSEC_ENABLE=On
&nbsp;
SetEnvIfNoCase ^WWW-Auth "(.+)" HTTP_WWW_AUTHORIZATION=$1
SetEnvIfNoCase ^If "(.+)" HTTP_IF_MODIFIED_SINCE=$1
SetEnvIfNoCase ^If-None-Match$ "(.+)" HTTP_IF_NONE_MATCH=$1
SetEnvIfNoCase ^Cache-Control$ "(.+)" HTTP_CACHE_CONTROL=$1
SetEnvIfNoCase ^Connection$ "(.+)" HTTP_CONNECTION=$1
SetEnvIfNoCase ^Keep-Alive$ "(.+)" HTTP_KEEP_ALIVE=$1
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
SetEnvIfNoCase ^Authorization$ ".+username=\"(.+)\".+" HTTP_REMOTE_USER=$1
SetEnvIfNoCase ^Content-Type$ "(.+)" HTTP_CONTENT_TYPE=$1
SetEnvIfNoCase ^Content-Length$ "(.+)" HTTP_CONTENT_LENGTH=$1
SetEnvIfNoCase Server_Addr "(.+)" SERVER_ADDR=$1
SetEnvIfNoCase Request_Method "(.+)" REQUEST_METHOD=$1
SetEnvIfNoCase Request_Protocol "(.+)" REQUEST_PROTOCOL=$1
SetEnvIfNoCase Request_URI "(.+)" REQUEST_URI=$1
&nbsp;
ErrorDocument 100 /cgi-bin/rewrite-test/index.php?g=100
ErrorDocument 101 /cgi-bin/rewrite-test/index.php?g=101
ErrorDocument 102 /cgi-bin/rewrite-test/index.php?g=102
ErrorDocument 200 /cgi-bin/rewrite-test/index.php?g=200
ErrorDocument 201 /cgi-bin/rewrite-test/index.php?g=201
ErrorDocument 202 /cgi-bin/rewrite-test/index.php?g=202
ErrorDocument 203 /cgi-bin/rewrite-test/index.php?g=203
ErrorDocument 204 /cgi-bin/rewrite-test/index.php?g=204
ErrorDocument 205 /cgi-bin/rewrite-test/index.php?g=205
ErrorDocument 206 /cgi-bin/rewrite-test/index.php?g=206
ErrorDocument 207 /cgi-bin/rewrite-test/index.php?g=207
ErrorDocument 300 /cgi-bin/rewrite-test/index.php?g=300
ErrorDocument 301 /cgi-bin/rewrite-test/index.php?g=301
ErrorDocument 302 /cgi-bin/rewrite-test/index.php?g=302
ErrorDocument 303 /cgi-bin/rewrite-test/index.php?g=303
ErrorDocument 304 /cgi-bin/rewrite-test/index.php?g=304
ErrorDocument 305 /cgi-bin/rewrite-test/index.php?g=305
ErrorDocument 306 /cgi-bin/rewrite-test/index.php?g=306
ErrorDocument 307 /cgi-bin/rewrite-test/index.php?g=307
ErrorDocument 400 /cgi-bin/rewrite-test/index.php?g=400
ErrorDocument 401 /cgi-bin/rewrite-test/index.php?g=401
ErrorDocument 402 /cgi-bin/rewrite-test/index.php?g=402
ErrorDocument 403 /cgi-bin/rewrite-test/index.php?g=403
ErrorDocument 404 /cgi-bin/rewrite-test/index.php?g=404
ErrorDocument 405 /cgi-bin/rewrite-test/index.php?g=405
ErrorDocument 406 /cgi-bin/rewrite-test/index.php?g=406
ErrorDocument 407 /cgi-bin/rewrite-test/index.php?g=407
ErrorDocument 408 /cgi-bin/rewrite-test/index.php?g=408
ErrorDocument 409 /cgi-bin/rewrite-test/index.php?g=409
ErrorDocument 410 /cgi-bin/rewrite-test/index.php?g=410
ErrorDocument 411 /cgi-bin/rewrite-test/index.php?g=411
ErrorDocument 412 /cgi-bin/rewrite-test/index.php?g=412
ErrorDocument 413 /cgi-bin/rewrite-test/index.php?g=413
ErrorDocument 414 /cgi-bin/rewrite-test/index.php?g=414
ErrorDocument 415 /cgi-bin/rewrite-test/index.php?g=415
ErrorDocument 416 /cgi-bin/rewrite-test/index.php?g=416
ErrorDocument 417 /cgi-bin/rewrite-test/index.php?g=417
ErrorDocument 418 /cgi-bin/rewrite-test/index.php?g=418
ErrorDocument 419 /cgi-bin/rewrite-test/index.php?g=419
ErrorDocument 420 /cgi-bin/rewrite-test/index.php?g=420
ErrorDocument 421 /cgi-bin/rewrite-test/index.php?g=421
ErrorDocument 422 /cgi-bin/rewrite-test/index.php?g=422
ErrorDocument 423 /cgi-bin/rewrite-test/index.php?g=423
ErrorDocument 424 /cgi-bin/rewrite-test/index.php?g=424
ErrorDocument 425 /cgi-bin/rewrite-test/index.php?g=425
ErrorDocument 426 /cgi-bin/rewrite-test/index.php?g=426
ErrorDocument 500 /cgi-bin/rewrite-test/index.php?g=500
ErrorDocument 501 /cgi-bin/rewrite-test/index.php?g=501
ErrorDocument 502 /cgi-bin/rewrite-test/index.php?g=502
ErrorDocument 503 /cgi-bin/rewrite-test/index.php?g=503
ErrorDocument 504 /cgi-bin/rewrite-test/index.php?g=504
ErrorDocument 505 /cgi-bin/rewrite-test/index.php?g=505
ErrorDocument 506 /cgi-bin/rewrite-test/index.php?g=506
ErrorDocument 507 /cgi-bin/rewrite-test/index.php?g=507
ErrorDocument 508 /cgi-bin/rewrite-test/index.php?g=508
ErrorDocument 509 /cgi-bin/rewrite-test/index.php?g=509
ErrorDocument 510 /cgi-bin/rewrite-test/index.php?g=510
&nbsp;
RewriteEngine On
RewriteBase /
&nbsp;
RewriteRule .* - [E=IN_AUTH_TYPE:%{AUTH_TYPE}]
RewriteRule .* - [E=IN_CONTENT_LENGTH:%{CONTENT_LENGTH}]
RewriteRule .* - [E=IN_CONTENT_TYPE:%{CONTENT_TYPE}]
RewriteRule .* - [E=IN_DATE_GMT:%{DATE_GMT}]
RewriteRule .* - [E=IN_DATE_LOCAL:%{DATE_LOCAL}]
RewriteRule .* - [E=IN_DOCUMENT_NAME:%{DOCUMENT_NAME}]
RewriteRule .* - [E=IN_DOCUMENT_PATH_INFO:%{DOCUMENT_PATH_INFO}]
RewriteRule .* - [E=IN_DOCUMENT_ROOT:%{DOCUMENT_ROOT}]
RewriteRule .* - [E=IN_DOCUMENT_URI:%{DOCUMENT_URI}]
RewriteRule .* - [E=IN_GATEWAY_INTERFACE:%{GATEWAY_INTERFACE}]
RewriteRule .* - [E=IN_LAST_MODIFIED:%{LAST_MODIFIED}]
RewriteRule .* - [E=IN_PATH_INFO:%{PATH_INFO}]
RewriteRule .* - [E=IN_PATH_TRANSLATED:%{PATH_TRANSLATED}]
RewriteRule .* - [E=IN_QUERY_STRING:%{QUERY_STRING}]
RewriteRule .* - [E=IN_QUERY_STRING_UNESCAPED:%{QUERY_STRING_UNESCAPED}]
RewriteRule .* - [E=IN_REMOTE_ADDR:%{REMOTE_ADDR}]
RewriteRule .* - [E=IN_REMOTE_HOST:%{REMOTE_HOST}]
RewriteRule .* - [E=IN_REMOTE_IDENT:%{REMOTE_IDENT}]
RewriteRule .* - [E=IN_REMOTE_PORT:%{REMOTE_PORT}]
RewriteRule .* - [E=IN_REMOTE_USER:%{REMOTE_USER}]
RewriteRule .* - [E=IN_REDIRECT_HANDLER:%{REDIRECT_HANDLER}]
RewriteRule .* - [E=IN_REDIRECT_QUERY_STRING:%{REDIRECT_QUERY_STRING}]
RewriteRule .* - [E=IN_REDIRECT_REMOTE_USER:%{REDIRECT_REMOTE_USER}]
RewriteRule .* - [E=IN_REDIRECT_STATUS:%{REDIRECT_STATUS}]
RewriteRule .* - [E=IN_REDIRECT_URL:%{REDIRECT_URL}]
RewriteRule .* - [E=IN_REQUEST_METHOD:%{REQUEST_METHOD}]
RewriteRule .* - [E=IN_REQUEST_URI:%{REQUEST_URI}]
RewriteRule .* - [E=IN_SCRIPT_FILENAME:%{SCRIPT_FILENAME}]
RewriteRule .* - [E=IN_SCRIPT_NAME:%{SCRIPT_NAME}]
RewriteRule .* - [E=IN_SERVER_ADMIN:%{SERVER_ADMIN}]
RewriteRule .* - [E=IN_SERVER_NAME:%{SERVER_NAME}]
RewriteRule .* - [E=IN_SERVER_ADDR:%{SERVER_ADDR}]
RewriteRule .* - [E=IN_SERVER_PORT:%{SERVER_PORT}]
RewriteRule .* - [E=IN_SERVER_PROTOCOL:%{SERVER_PROTOCOL}]
RewriteRule .* - [E=IN_SERVER_SIGNATURE:%{SERVER_SIGNATURE}]
RewriteRule .* - [E=IN_SERVER_SOFTWARE:%{SERVER_SOFTWARE}]
RewriteRule .* - [E=IN_USER_NAME:%{USER_NAME}]
RewriteRule .* - [E=IN_TZ:%{TZ}]
RewriteRule .* - [E=IN_API_VERSION:%{API_VERSION}]
RewriteRule .* - [E=IN_HTTPS:%{HTTPS}]
RewriteRule .* - [E=IN_HTTP_ACCEPT:%{HTTP_ACCEPT}]
RewriteRule .* - [E=IN_HTTP_ACCEPT_CHARSET:%{HTTP_ACCEPT_CHARSET}]
RewriteRule .* - [E=IN_HTTP_ACCEPT_ENCODING:%{HTTP_ACCEPT_ENCODING}]
RewriteRule .* - [E=IN_HTTP_ACCEPT_LANGUAGE:%{HTTP_ACCEPT_LANGUAGE}]
RewriteRule .* - [E=IN_HTTP_CACHE_CONTROL:%{HTTP_CACHE_CONTROL}]
RewriteRule .* - [E=IN_HTTP_CONNECTION:%{HTTP_CONNECTION}]
RewriteRule .* - [E=IN_HTTP_COOKIE:%{HTTP_COOKIE}]
RewriteRule .* - [E=IN_HTTP_FORWARDED:%{HTTP_FORWARDED}]
RewriteRule .* - [E=IN_HTTP_HOST:%{HTTP_HOST}]
RewriteRule .* - [E=IN_HTTP_KEEP_ALIVE:%{HTTP_KEEP_ALIVE}]
RewriteRule .* - [E=IN_HTTP_PROXY_CONNECTION:%{HTTP_PROXY_CONNECTION}]
RewriteRule .* - [E=IN_HTTP_REFERER:%{HTTP_REFERER}]
RewriteRule .* - [E=IN_HTTP_USER_AGENT:%{HTTP_USER_AGENT}]
RewriteRule .* - [E=IN_IS_SUBREQ:%{IS_SUBREQ}]
RewriteRule .* - [E=IN_ORIG_PATH_INFO:%{ORIG_PATH_INFO}]
RewriteRule .* - [E=IN_ORIG_PATH_TRANSLATED:%{ORIG_PATH_TRANSLATED}]
RewriteRule .* - [E=IN_ORIG_SCRIPT_FILENAME:%{ORIG_SCRIPT_FILENAME}]
RewriteRule .* - [E=IN_ORIG_SCRIPT_NAME:%{ORIG_SCRIPT_NAME}]
RewriteRule .* - [E=IN_PATH:%{PATH}]
RewriteRule .* - [E=IN_PHP_SELF:%{PHP_SELF}]
RewriteRule .* - [E=IN_REQUEST_FILENAME:%{REQUEST_FILENAME}]
RewriteRule .* - [E=IN_REQUEST_TIME:%{REQUEST_TIME}]
RewriteRule .* - [E=IN_SCRIPT_GROUP:%{SCRIPT_GROUP}]
RewriteRule .* - [E=IN_SCRIPT_USER:%{SCRIPT_USER}]
RewriteRule .* - [E=IN_THE_REQUEST:%{THE_REQUEST}]
RewriteRule .* - [E=IN_TIME:%{TIME}]
RewriteRule .* - [E=IN_TIME_DAY:%{TIME_DAY}]
RewriteRule .* - [E=IN_TIME_HOUR:%{TIME_HOUR}]
RewriteRule .* - [E=IN_TIME_MIN:%{TIME_MIN}]
RewriteRule .* - [E=IN_TIME_MON:%{TIME_MON}]
RewriteRule .* - [E=IN_TIME_SEC:%{TIME_SEC}]
RewriteRule .* - [E=IN_TIME_WDAY:%{TIME_WDAY}]
RewriteRule .* - [E=IN_TIME_YEAR:%{TIME_YEAR}]
RewriteRule .* - [E=IN_PATH:%{PATH}]
RewriteRule .* - [E=IN_SCRIPT_URI:%{SCRIPT_URI}]
RewriteRule .* - [E=IN_SCRIPT_URL:%{SCRIPT_URL}]
RewriteRule .* - [E=IN_UNIQUE_ID:%{UNIQUE_ID}]
&nbsp;
RewriteRule .* - [E=ENV_PATH:%{ENV:PATH}]
RewriteRule .* - [E=ENV_SCRIPT_URI:%{ENV:SCRIPT_URI}]
RewriteRule .* - [E=ENV_SCRIPT_URL:%{ENV:SCRIPT_URL}]
RewriteRule .* - [E=ENV_UNIQUE_ID:%{ENV:UNIQUE_ID}]
&nbsp;
RequestHeader set AUTH_TYPE "%{IN_AUTH_TYPE}e"
RequestHeader set CONTENT_LENGTH "%{IN_CONTENT_LENGTH}e"
RequestHeader set CONTENT_TYPE "%{IN_CONTENT_TYPE}e"
RequestHeader set DATE_GMT "%{IN_DATE_GMT}e"
RequestHeader set DATE_LOCAL "%{IN_DATE_LOCAL}e"
RequestHeader set DOCUMENT_NAME "%{IN_DOCUMENT_NAME}e"
RequestHeader set DOCUMENT_PATH_INFO "%{IN_DOCUMENT_PATH_INFO}e"
RequestHeader set DOCUMENT_ROOT "%{IN_DOCUMENT_ROOT}e"
RequestHeader set DOCUMENT_URI "%{IN_DOCUMENT_URI}e"
RequestHeader set GATEWAY_INTERFACE "%{IN_GATEWAY_INTERFACE}e"
RequestHeader set LAST_MODIFIED "%{IN_LAST_MODIFIED}e"
RequestHeader set PATH_INFO "%{IN_PATH_INFO}e"
RequestHeader set PATH_TRANSLATED "%{IN_PATH_TRANSLATED}e"
RequestHeader set QUERY_STRING "%{IN_QUERY_STRING}e"
RequestHeader set QUERY_STRING_UNESCAPED "%{IN_QUERY_STRING_UNESCAPED}e"
RequestHeader set REMOTE_ADDR "%{IN_REMOTE_ADDR}e"
RequestHeader set REMOTE_HOST "%{IN_REMOTE_HOST}e"
RequestHeader set REMOTE_IDENT "%{IN_REMOTE_IDENT}e"
RequestHeader set REMOTE_PORT "%{IN_REMOTE_PORT}e"
RequestHeader set REMOTE_USER "%{IN_REMOTE_USER}e"
RequestHeader set REDIRECT_HANDLER "%{IN_REDIRECT_HANDLER}e"
RequestHeader set REDIRECT_QUERY_STRING "%{IN_REDIRECT_QUERY_STRING}e"
RequestHeader set REDIRECT_REMOTE_USER "%{IN_REDIRECT_REMOTE_USER}e"
RequestHeader set REDIRECT_STATUS "%{IN_REDIRECT_STATUS}e"
RequestHeader set REDIRECT_URL "%{IN_REDIRECT_URL}e"
RequestHeader set REQUEST_METHOD "%{IN_REQUEST_METHOD}e"
RequestHeader set REQUEST_URI "%{IN_REQUEST_URI}e"
RequestHeader set SCRIPT_FILENAME "%{IN_SCRIPT_FILENAME}e"
RequestHeader set SCRIPT_NAME "%{IN_SCRIPT_NAME}e"
RequestHeader set SCRIPT_URI "%{IN_SCRIPT_URI}e"
RequestHeader set SCRIPT_URL "%{IN_SCRIPT_URL}e"
RequestHeader set SERVER_ADMIN "%{IN_SERVER_ADMIN}e"
RequestHeader set SERVER_NAME "%{IN_SERVER_NAME}e"
RequestHeader set SERVER_ADDR "%{IN_SERVER_ADDR}e"
RequestHeader set SERVER_PORT "%{IN_SERVER_PORT}e"
RequestHeader set SERVER_PROTOCOL "%{IN_SERVER_PROTOCOL}e"
RequestHeader set SERVER_SIGNATURE "%{IN_SERVER_SIGNATURE}e"
RequestHeader set SERVER_SOFTWARE "%{IN_SERVER_SOFTWARE}e"
RequestHeader set UNIQUE_ID "%{IN_UNIQUE_ID}e"
RequestHeader set USER_NAME "%{IN_USER_NAME}e"
RequestHeader set TZ "%{IN_TZ}e"
RequestHeader set API_VERSION "%{IN_API_VERSION}e"
RequestHeader set HTTPS "%{IN_HTTPS}e"
RequestHeader set HTTP_ACCEPT "%{IN_HTTP_ACCEPT}e"
RequestHeader set HTTP_ACCEPT_CHARSET "%{IN_HTTP_ACCEPT_CHARSET}e"
RequestHeader set HTTP_ACCEPT_ENCODING "%{IN_HTTP_ACCEPT_ENCODING}e"
RequestHeader set HTTP_ACCEPT_LANGUAGE "%{IN_HTTP_ACCEPT_LANGUAGE}e"
RequestHeader set HTTP_CACHE_CONTROL "%{IN_HTTP_CACHE_CONTROL}e"
RequestHeader set HTTP_CONNECTION "%{IN_HTTP_CONNECTION}e"
RequestHeader set HTTP_COOKIE "%{IN_HTTP_COOKIE}e"
RequestHeader set HTTP_FORWARDED "%{IN_HTTP_FORWARDED}e"
RequestHeader set HTTP_HOST "%{IN_HTTP_HOST}e"
RequestHeader set HTTP_KEEP_ALIVE "%{IN_HTTP_KEEP_ALIVE}e"
RequestHeader set HTTP_PROXY_CONNECTION "%{IN_HTTP_PROXY_CONNECTION}e"
RequestHeader set HTTP_REFERER "%{IN_HTTP_REFERER}e"
RequestHeader set HTTP_USER_AGENT "%{IN_HTTP_USER_AGENT}e"
RequestHeader set IS_SUBREQ "%{IN_IS_SUBREQ}e"
RequestHeader set ORIG_PATH_INFO "%{IN_ORIG_PATH_INFO}e"
RequestHeader set ORIG_PATH_TRANSLATED "%{IN_ORIG_PATH_TRANSLATED}e"
RequestHeader set ORIG_SCRIPT_FILENAME "%{IN_ORIG_SCRIPT_FILENAME}e"
RequestHeader set ORIG_SCRIPT_NAME "%{IN_ORIG_SCRIPT_NAME}e"
RequestHeader set PATH "%{IN_PATH}e"
RequestHeader set PHP_SELF "%{IN_PHP_SELF}e"
RequestHeader set REQUEST_FILENAME "%{IN_REQUEST_FILENAME}e"
RequestHeader set REQUEST_TIME "%{IN_REQUEST_TIME}e"
RequestHeader set SCRIPT_GROUP "%{IN_SCRIPT_GROUP}e"
RequestHeader set SCRIPT_USER "%{IN_SCRIPT_USER}e"
RequestHeader set THE_REQUEST "%{IN_THE_REQUEST}e"
RequestHeader set TIME "%{IN_TIME}e"
RequestHeader set TIME_DAY "%{IN_TIME_DAY}e"
RequestHeader set TIME_HOUR "%{IN_TIME_HOUR}e"
RequestHeader set TIME_MIN "%{IN_TIME_MIN}e"
RequestHeader set TIME_MON "%{IN_TIME_MON}e"
RequestHeader set TIME_SEC "%{IN_TIME_SEC}e"
RequestHeader set TIME_WDAY "%{IN_TIME_WDAY}e"
RequestHeader set TIME_YEAR "%{IN_TIME_YEAR}e"
&nbsp;
SetEnvIfNoCase ^WWW-Auth "(.+)" HTTP_WWW_AUTHORIZATION=$1
SetEnvIfNoCase ^If "(.+)" HTTP_IF_MODIFIED_SINCE=$1
SetEnvIfNoCase ^If-None-Match$ "(.+)" HTTP_IF_NONE_MATCH=$1
SetEnvIfNoCase ^Cache-Control$ "(.+)" HTTP_CACHE_CONTROL=$1
SetEnvIfNoCase ^Connection$ "(.+)" HTTP_CONNECTION=$1
SetEnvIfNoCase ^Keep-Alive$ "(.+)" HTTP_KEEP_ALIVE=$1
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
SetEnvIfNoCase ^Content-Type$ "(.+)" HTTP_CONTENT_TYPE=$1
SetEnvIfNoCase ^Content-Length$ "(.+)" HTTP_CONTENT_LENGTH=$1
SetEnvIfNoCase ^Authorization$ ".+username=\"([a-zA-Z0-9]+)\".+" REMOTE_USER=$1
SetEnvIfNoCase Server_Addr "(.+)" SERVER_ADDR=$1
SetEnvIfNoCase Request_Method "(.+)" REQUEST_METHOD=$1
SetEnvIfNoCase Request_Protocol "(.+)" REQUEST_PROTOCOL=$1
SetEnvIfNoCase Request_URI "(.+)" REQUEST_URI=$1
&nbsp;
RequestHeader set IF_MODIFIED_SINCE "%{HTTP_IF_MODIFIED_SINCE}e"
RequestHeader set IF_NONE_MATCH "%{HTTP_IF_NONE_MATCH}e"
RequestHeader set CACHE_CONTROL "%{HTTP_CACHE_CONTROL}e"
RequestHeader set CONNECTION "%{HTTP_CONNECTION}e"
RequestHeader set KEEP_ALIVE "%{HTTP_KEEP_ALIVE}e"
RequestHeader set AUTHORIZATION "%{HTTP_AUTHORIZATION}e"
RequestHeader set REMOTE_USER "%{REMOTE_USER}e"
RequestHeader set CONTENT_TYPE "%{HTTP_CONTENT_TYPE}e"
RequestHeader set CONTENT_LENGTH "%{HTTP_CONTENT_LENGTH}e"
RequestHeader set SERVER_ADDR "%{SERVER_ADDR}e"
RequestHeader set REQUEST_METHOD "%{REQUEST_METHOD}e"
RequestHeader set REQUEST_PROTOCOL "%{REQUEST_PROTOCOL}e"
RequestHeader set REQUEST_URI "%{REQUEST_URI}e"
&nbsp;
RequestHeader set UNIQUE_ID "%{ENV_UNIQUE_ID}e"
RequestHeader set SCRIPT_URL "%{ENV_SCRIPT_URL}e"
RequestHeader set SCRIPT_URI "%{ENV_SCRIPT_URI}e"
RequestHeader set PATH "%{ENV_PATH}e"
&nbsp;
Options +ExecCGI +FollowSymLinks
&nbsp;
Order Deny,Allow
Deny from All
Allow from 208.113.134.190  64.111.114.111 208.113.134.203 208.113.152.201 env=REDIRECT_STATUS
Satisfy Any
&nbsp;
SecFilterEngine Off</pre>



<h2>More Mod_Security (1)</h2>
<pre>#
# Order Deny,Allow
# First, all Allow directives are evaluated; at least one must match, or the request is rejected.
# Next, all Deny directives are evaluated. If any matches, the request is rejected.
# Last, any requests which do not match an Allow or a Deny directive are denied by default.
#
Order Allow,Deny
Allow from all
Deny from 217.219.
&nbsp;
#Order Deny,Allow
# First, all Deny directives are evaluated; if any match, the request is denied unless it also matches an Allow directive.
# Any requests which do not match any Allow or Deny directives are permitted.
&nbsp;
#SetEnvIf content-type (multipart/form-data)(.*) NEW_CONTENT_TYPE=application/x-www-form-urlencoded$2 OLD_CONTENT_TYPE=$1$2
#RequestHeader set content-type %{NEW_CONTENT_TYPE}e env=NEW_CONTENT_TYPE
SetEnvIfNoCase Content-Type "^multipart/form-data" !MODSEC_NOPOSTBUFFERING
SetEnvIfNoCase Content-Type "^application/x-www-form-urlencoded" !MODSEC_NOPOSTBUFFERING
SetEnv suppress-error-charset
SetEnvIfNoCase Content-Type "^multipart/form-data" !MODSEC_NOPOSTBUFFERING
&nbsp;
SetEnvIf Request_URI "^/(cgi-bin/search\.php|cgi-bin/java\.cgi|wp-admin/.*)" MODSEC_ENABLE=Off
SetEnvIf Request_URI "^/(online-tools/js-compress.*)" "MODSEC_NOPOSTBUFFERING=Do not buffer file uploads"
SetEnvIfNoCase Remote_Addr ^208\.113\.134\.190$ MODSEC_ENABLE=Off
SetEnvIfNoCase Remote_Addr ^64\.111\.114\.111$ MODSEC_ENABLE=Off
&nbsp;
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#
#
# TZ: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
SetEnv TZ America/Indianapolis
&nbsp;
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
SetEnv SERVER_ADMIN webmaster@askapache.com
&nbsp;
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature Off
&nbsp;
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.0/mod/core.html#options
# for more information.
#
Options -Indexes -Includes -ExecCGI -MultiViews
&nbsp;
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.php
&nbsp;
#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
Action php5-cgi /bin/php.cgi
&nbsp;
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler php5-cgi .php .inc
&nbsp;
#
# Commonly used filename extensions to character sets. You probably
# want to avoid clashes with the language extensions, unless you
# are good at carefully testing your setup after each change.
# See http://www.iana.org/assignments/character-sets for the
# official list of charset names and their respective RFCs.
#
AddDefaultCharset UTF-8
&nbsp;
#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
#
AddType &#039;application/rdf+xml; charset=UTF-8&#039; .rdf
AddType &#039;application/xhtml+xml; charset=UTF-8&#039; .xhtml
AddType &#039;application/xhtml+xml; charset=UTF-8&#039; .xhtml.gz
AddType &#039;text/html; charset=UTF-8&#039; .html
AddType &#039;text/html; charset=UTF-8&#039; .html.gz
AddType application/octet-stream .rar .chm .bz2 .tgz .msi .pdf .exe
AddType application/vnd.ms-excel .csv
AddType application/x-httpd-php-source .phps
AddType application/x-pilot .prc .pdb
AddType application/x-shockwave-flash .swf
AddType application/xrds+xml .xrdf
AddType text/plain .ini .sh .bsh .bash .awk .nawk .gawk .csh .var .c .in .h .asc .md5 .sha .sha1
AddType video/x-flv .flv
&nbsp;
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
&nbsp;
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/html</pre>




<h2>Error Documents</h2>
<pre>#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
#100 Continue
#101 Switching Protocols
#102 Processing
#200 OK
#201 Created
#202 Accepted
#203 Non-Authoritative Information
#204 No Content
#205 Reset Content
#206 Partial Content
#207 Multi-Status
#300 Multiple Choices
#301 Moved Permanently
#302 Found
#303 See Other
#304 Not Modified
#305 Use Proxy
#306 unused
#307 Temporary Redirect
#400 Bad Request
#401 Authorization Required
#402 Payment Required
#403 Forbidden
#404 Not Found
#405 Method Not Allowed
#406 Not Acceptable
#407 Proxy Authentication Required
#408 Request Time-out
#409 Conflict
#410 Gone
#411 Length Required
#412 Precondition Failed
#413 Request Entity Too Large
#414 Request-URI Too Large
#415 Unsupported Media Type
#416 Requested Range Not Satisfiable
#417 Expectation Failed
#418 unused
#419 unused
#420 unused
#421 unused
#422 Unprocessable Entity
#423 Locked
#424 Failed Dependency
#425 No code
#426 Upgrade Required
#500 Internal Server Error
#501 Method Not Implemented
#502 Bad Gateway
#503 Service Temporarily Unavailable
#504 Gateway Time-out
#505 HTTP Version Not Supported
#506 Variant Also Negotiates
#507 Insufficient Storage
#508 unused
#509 unused
#510 Not Extended
&nbsp;
#ErrorDocument 100 /e/100_CONTINUE.html
#ErrorDocument 101 /e/101_SWITCHING_PROTOCOLS.html
#ErrorDocument 102 /e/102_PROCESSING.html
&nbsp;
#ErrorDocument 200 /e/200_OK.html
#ErrorDocument 201 /e/201_CREATED.html
#ErrorDocument 202 /e/202_ACCEPTED.html
#ErrorDocument 203 /e/203_NON_AUTHORITATIVE.html
#ErrorDocument 204 /e/204_NO_CONTENT.html
#ErrorDocument 205 /e/205_RESET_CONTENT.html
#ErrorDocument 206 /e/206_PARTIAL_CONTENT.html
#ErrorDocument 207 /e/207_MULTI_STATUS.html
&nbsp;
#ErrorDocument 300 /e/300_MULTIPLE_CHOICES.html
#ErrorDocument 301 /e/301_MOVED_PERMANENTLY.html
#ErrorDocument 302 /e/302_MOVED_TEMPORARILY.html
#ErrorDocument 303 /e/303_SEE_OTHER.html
#ErrorDocument 304 /e/304_NOT_MODIFIED.html
#ErrorDocument 305 /e/305_USE_PROXY.html
#ErrorDocument 307 /e/307_TEMPORARY_REDIRECT.html
&nbsp;
ErrorDocument 400 /e/400_BAD_REQUEST.html
ErrorDocument 401 /e/401_UNAUTHORIZED.html
ErrorDocument 402 /e/402_PAYMENT_REQUIRED.html
ErrorDocument 403 /e/403_FORBIDDEN.html
#ErrorDocument 404 /e/404_NOT_FOUND.html
ErrorDocument 404 /index.php?error=404
ErrorDocument 405 /e/405_METHOD_NOT_ALLOWED.html
ErrorDocument 406 /e/406_NOT_ACCEPTABLE.html
ErrorDocument 407 /e/407_PROXY_AUTHENTICATION_REQUIRED.html
ErrorDocument 408 /e/408_REQUEST_TIME_OUT.html
ErrorDocument 409 /e/409_CONFLICT.html
ErrorDocument 410 /e/410_GONE.html
ErrorDocument 411 /e/411_LENGTH_REQUIRED.html
ErrorDocument 412 /e/412_PRECONDITION_FAILED.html
ErrorDocument 413 /e/413_REQUEST_ENTITY_TOO_LARGE.html
ErrorDocument 414 /e/414_REQUEST_URI_TOO_LARGE.html
ErrorDocument 415 /e/415_UNSUPPORTED_MEDIA_TYPE.html
ErrorDocument 416 /e/416_RANGE_NOT_SATISFIABLE.html
ErrorDocument 417 /e/417_EXPECTATION_FAILED.html
ErrorDocument 422 /e/422_UNPROCESSABLE_ENTITY.html
ErrorDocument 423 /e/423_LOCKED.html
ErrorDocument 424 /e/424_FAILED_DEPENDENCY.html
ErrorDocument 426 /e/426_UPGRADE_REQUIRED.html
ErrorDocument 500 /e/500_INTERNAL_SERVER_ERROR.html
ErrorDocument 501 /e/501_NOT_IMPLEMENTED.html
ErrorDocument 502 /e/502_BAD_GATEWAY.html
ErrorDocument 503 /e/503_SERVICE_UNAVAILABLE.html
ErrorDocument 504 /e/504_GATEWAY_TIME_OUT.html
ErrorDocument 505 /e/505_VERSION_NOT_SUPPORTED.html
ErrorDocument 506 /e/506_VARIANT_ALSO_VARIES.html
ErrorDocument 507 /e/507_INSUFFICIENT_STORAGE.html
ErrorDocument 510 /e/510_NOT_EXTENDED.html</pre>



<h2>Caching</h2>
<pre>#
#  HEADERS and CACHING
#
Header unset Pragma
FileETag None
Header unset ETag
&nbsp;
# 1 YEAR
&lt;filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"&gt;
Header unset P3P
Header unset Pragma
FileETag None
Header unset ETag
Header set Cache-Control "public,max-age=29030400"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
Header unset Last-Modified
&lt;/filesMatch&gt;
&nbsp;
# 2 HOURS
&lt;filesMatch "\.(html|htm|xml|txt|xsl|rdf|rss)$"&gt;
&lt;ifModule mod_expires.c&gt;
ExpiresActive On
ExpiresDefault A3600
&lt;/ifModule&gt;
&lt;/filesMatch&gt;</pre>



<h2>Redirect Hack</h2>
<pre>#Redirect 400 /e/400
#Redirect 401 /e/401
#Redirect 402 /e/402
#Redirect 403 /e/403
Redirect 404 /index.php?error=404
#Redirect 405 /e/405
#Redirect 406 /e/406
#Redirect 407 /e/407
#Redirect 408 /e/408
#Redirect 409 /e/409
#Redirect 410 /e/410
#Redirect 411 /e/411
#Redirect 412 /e/412
#Redirect 413 /e/413
#Redirect 414 /e/414
#Redirect 415 /e/415
#Redirect 416 /e/416
#Redirect 417 /e/417
#Redirect 418 /e/418
#Redirect 419 /e/419
#Redirect 420 /e/420
#Redirect 421 /e/421
#Redirect 422 /e/422
#Redirect 423 /e/423
#Redirect 424 /e/424
#Redirect 425 /e/425
#Redirect 426 /e/426
#Redirect 500 /e/500
#Redirect 501 /e/501
#Redirect 502 /e/502
#Redirect 503 /e/503
#Redirect 504 /e/504
#Redirect 505 /e/505
#Redirect 506 /e/506
#Redirect 507 /e/507
#Redirect 508 /e/508
#Redirect 509 /e/509
#Redirect 510 /e/510</pre>

<h2>301 PERMANENT REDIRECTS</h2>
<pre>#
# Redirect allows you to tell clients about documents which used to exist in
# your server&#039;s namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
#
Redirect 301 /12-lessons-for-those-afraid-of-css.html http://www.askapache.com/css/12-lessons-for-those-afraid-of-css.html
Redirect 301 /2006/htaccess/htaccesselite-ultimate-htaccess-article.html http://www.askapache.com/htaccess/apache-htaccess.html
Redirect 301 /2007/phpbb/sending-post-form-data-with-php-curl.html http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
Redirect 301 /2007/webmaster/php-and-ajax-shell-console.html http://www.askapache.com/tools/php-and-ajax-shell-console.html
Redirect 301 /27-request-methods-for-use-with-apache-and-rewritecond-and-htaccess.html http://www.askapache.com/htaccess/27-request-methods-for-use-with-apache-and-rewritecond-and-htaccess.html
Redirect 301 /404-google-wordpress-plugin.html http://www.askapache.com/seo/404-google-wordpress-plugin.html
Redirect 301 /503-service-temporarily-unavailable.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /Overview-about.rdf http://www.askapache.com/askapache-home.rdf
Redirect 301 /abbr-acronym.html http://www.askapache.com/xhtml/abbr-acronym.html
Redirect 301 /adsense-robots.html http://www.askapache.com/google/adsense-robots.html
Redirect 301 /alexa-toolbar-firefox.html http://www.askapache.com/tools/alexa-toolbar-firefox.html
Redirect 301 /allowing-access-from-1-static-ip-and-deny-the-rest.html http://www.askapache.com/htaccess/apache-htaccess.html
Redirect 301 /anti-virus-spyware-rootkit.html http://www.askapache.com/security/anti-virus-spyware-rootkit.html
Redirect 301 /apache-ssl-in-htaccess-examples.html http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html
Redirect 301 /awk-tutorial.html http://www.askapache.com/awk/awk-tutorial.html
Redirect 301 /best-adsense-optimization.html http://www.askapache.com/wordpress/best-adsense-optimization.html
Redirect 301 /commonly-used-htaccess-code-examples.html http://www.askapache.com/htaccess/commonly-used-htaccess-code-examples.html
Redirect 301 /css-background-image-sprite.html http://www.askapache.com/css/css-background-image-sprite.html
Redirect 301 /css-browser-screenshots.html http://www.askapache.com/tools/css-browser-screenshots.html
Redirect 301 /css-class-example.html http://www.askapache.com/css/css-class-example.html
Redirect 301 /curl-multi-downloads.html http://www.askapache.com/php/curl-multi-downloads.html
Redirect 301 /custom-boot-menu-in-windows-xp.html http://www.askapache.com/windows/custom-boot-menu-in-windows-xp.html
Redirect 301 /donate http://www.dreamhost.com/donate.cgi?id=8261
Redirect 301 /donate/ http://www.dreamhost.com/donate.cgi?id=8261
Redirect 301 /htaccess.txt http://z.askapache.com/p/htaccess.txt
Redirect 301 /htaccess/404-errorpages.html http://www.askapache.com/seo/google-ajax-search-seo-tips.html
Redirect 301 /htaccess/feedsmith http://www.askapache.com/htaccess/feedsmith-htaccess.html
Redirect 301 /htaccess/http-status-codes.html http://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html
Redirect 301 /htaccess/instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /htaccess/speed-up-the-apache-web-server-with-configuration-hacks.html http://www.askapache.com/htaccess/apache-web-server-speed-configuration-hacks.html
Redirect 301 /instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /security/bypassing-vlan.html http://www.askapache.com/security/hacking-vlan-switched-networks.html
Redirect 301 /security/bypassing-vlanbypassing-vlan.html http://www.askapache.com/security/hacking-vlan-switched-networks.html
Redirect 301 /security/rigging-the-dreamhost-site-of-the-month-contest.html http://www.askapache.com/dreamhost/rigging-the-dreamhost-site-of-the-month-contest.html
Redirect 301 /seo/tailrankcom-robot.html http://www.askapache.com/seo/tailrank-robot.html
Redirect 301 /webmaster/caching-tutorial-for-webmasters.html http://www.askapache.com/htaccess/caching-tutorial-for-webmasters.html
Redirect 301 /webmaster/lft-traceroute-tool.html http://www.askapache.com/tools/lft-traceroute-tool.html</pre>



<h2>301 PERMANENT REDIRECTMATCH</h2>
<pre>#
#  PERMANENT REDIRECTMATCH
#
#RedirectMatch 301 ^/&amp;(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/(.+)\.html/$ http://www.askapache.com/$1.html
RedirectMatch 301 ^/&amp;amp(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/.*feed\.gif$ http://z.askapache.com/feed.gif
RedirectMatch 301 ^/([^/]+)//$ http://www.askapache.com/$1/
RedirectMatch 301 ^/(.+)/htaccesselite-ultimate-htaccess-article.html(.*) http://www.askapache.com/htaccess/apache-htaccess.html
RedirectMatch 301 ^/(.+)\.html/([a-z][a-z])/$ http://www.askapache.com/$1.html
RedirectMatch 301 ^/([\(]+)(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/([^9]*)9O1X.3y(.*)/(.*)$ http://www.askapache.com/$2
RedirectMatch 301 ^/.3y(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/200([0-9])/([0-9])(.*)$ http://www.askapache.com/top-100/
RedirectMatch 301 ^/200([0-9])/([^01])(.*)$ http://www.askapache.com/$2$3
RedirectMatch 301 ^/about/glossary(.*)$ http://www.askapache.com/glossary$1
RedirectMatch 301 ^/apache-speed(.*)$ http://www.askapache.com/htaccess/apache-speed$1
RedirectMatch 301 ^/category/(.+)$ http://www.askapache.com/$1
RedirectMatch 301 ^/docs/(.*)$ http://askapache.info/$1
RedirectMatch 301 ^/htaccess/feedsmith-htaccess(.*) http://www.askapache.com/htaccess/redirecting-wordpress-feeds-to-feedburner.html
RedirectMatch 301 ^/robots-txt(.*)$ http://www.askapache.com/robots.txt
RedirectMatch 301 ^/hosting/?$ http://www.askapache.com/hosting/
RedirectMatch 301 ^/.+favicon.ico$ http://www.askapache.com/favicon.ico
#RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://z.askapache.com/uploads/$1
#RedirectMatch 301 ^/z/(.+)$ http://z.askapache.com/$1
#RedirectMatch 301 ^/(z|t|i|j|c|p)/(.*)$ http://z.askapache.com/$1/$2
&nbsp;
#
#  TEMPORARY REDIRECTMATCH
#
RedirectMatch 307 ^/getflash/?$ http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash
RedirectMatch 307 ^/dream/?$ http://www.askapache.com/dreamhost/
RedirectMatch 307 ^/(cse|apachecse|apachecsetest|apachesearch)/?$ http://www.google.com/coop/cse?cx=002660089121042511758%3Akk7rwc2gx0i
RedirectMatch 307 ^/search/lr-lang(.*)$ http://feeds.askapache.com/apache/htaccess
&nbsp;
#
#  PERMANENT GONE
#
RedirectMatch 410 ^/funny(.*)</pre>






<h2>My Favorite modsec_v1 stuff</h2>
<pre># Pass: Allows request to continue, further filters could still halt request.
# Allow: Allows matching requests through, will not be tested against other filters.
# Deny: Stops the request outright, returns a HTTP 500 error code by default.
# Status: Used to specify an alternate HTTP error code.
# Redirect: Matching requests are redirected to the provided URL.
# Exec: Allows execution of a local system binary or script.
# Log: Logs request only.
# Nolog: Does not log request.
# Chain: Allows you to create list of filters for more granulated security. All filters must be cleared before action is taken with the final filter.
&nbsp;
SecFilterEngine On
SecFilterCheckURLEncoding On
SecFilterCheckUnicodeEncoding Off
SecFilterScanPOST On
&nbsp;
#SecUploadKeepFiles On
#SecUploadDir /home/askapache/sites/askapache.com/logs/sec-upload
#SecUploadApproveScript /home/askapache/sites/askapache.com/htdocs/cgi-bin/check.sh
&nbsp;
#SecRuleEngine On
#SecAuditEngine On
#SecAuditEngine Off
SecAuditEngine RelevantOnly
SecAuditLog /home/askapache/sites/askapache.com/logs/modsec_audit.log
SecFilterDebugLog /home/askapache/sites/askapache.com/logs/modsec_debug.log
SecFilterDebugLevel 1
#SecAuditLogRelevantStatus "^(?:1|2(?!00)|5|4(?!04))"
SecAuditLogRelevantStatus "^(1|2(?!00)|4([0-9](0|1|2|5|6|7|8|9))|5)"
SecFilterForceByteRange 1 255
&nbsp;
#SecFilterInheritance Off
# 0 EMERGENCY - system is unusable
# 1 ALERT - action must be taken immediately
# 2 CRITICAL - critical conditions
# 3 ERROR - error conditions
# 4 WARNING - warning conditions
# 5 NOTICE - normal but significant conditions
# 6 INFO - informational
# 7 DEBUG - debug-level messages
&nbsp;
SecFilterDefaultAction "deny,severity:6,status:403"
&nbsp;
#SecFilterSelective REQUEST_METHOD "POST" "pass,auditlog,severity:6"
SecFilterSelective REQUEST_URI "^/(xmlrpc|wp-comments-post)\.php" "pass,log,auditlog,severity:6"
#SecFilterSelective REMOTE_ADDR ^$ "pass,log,auditlog,severity:6"
#SecFilterSelective REMOTE_ADDR ^203\.221\.91\.20$ "pass,log,auditlog,severity:6"
&nbsp;
#SecFilterSelective REQUEST_URI "^/htaccess.*" "pass,log,auditlog"
#SecFilterSelective REQUEST_URI "^/feed.*" "pass,log,auditlog"
#SecFilterSelective REQUEST_URI "^/.*trackback.*" "pass,log,auditlog"
#SecFilterSelective REQUEST_URI "^/valid.*" "pass,log,auditlog"
&nbsp;
#Enforce proper HTTP requests
SecFilterSelective SERVER_PROTOCOL "!^HTTP/(0\.9|1\.0|1\.1)$" "id:340000,rev:1,severity:6,msg:&#039;Bad HTTP Protocol&#039;"
&nbsp;
# Only accept request encodings we know how to handle
SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST)$" "chain,id:340001,rev:1,severity:6,msg:&#039;Restricted HTTP function,status:405&#039;"
SecFilterSelective HTTP_Content-Type "!(^$|^application/x-www-form-urlencoded$|^multipart/form-data)"
&nbsp;
# Require Content-Length to be provided with every POST request
SecFilterSelective REQUEST_METHOD "^POST$" "chain,id:340003,rev:1,severity:6,msg:&#039;Content Length not provided with POST&#039;,status:411"
SecFilterSelective HTTP_Content-Length "^$"
&nbsp;
# Don&#039;t accept transfer encodings we know we don&#039;t handle
# (and you don&#039;t need it anyway)
SecFilterSelective HTTP_Transfer-Encoding "!^$" "id:340004,rev:1,severity:6,msg:&#039;Dis-allowed Transfer Encoding&#039;"
&nbsp;
#Generic rule for allowed characters, adjust for your site before activating
##SecFilterSelective REQUEST_URI "!^[a-zA-Z0-9\.\+\_\/\-\?\=\&amp;\%\#]+$" "chain,id:390002,rev:1,severity:4,msg:&#039;Restricted HTTP character set&#039;"
##SecFilterSelective REQUEST_URI "!^/(openid|wp-admin|wp-includes|wp-content|wp-login.php)"
&nbsp;
#HTTP response splitting generic sigs
#SecFilter "Content-Length\:.*Content-Type\:.*Content-Type\:" "id:340005,rev:1,severity:4,msg:&#039;HTTP response splitting&#039;"
&nbsp;
#HTTP response splitting generic sigs
#SecFilter "Content-Length\:" "chain,id:340006,rev:1,severity:4,msg:&#039;HTTP response splitting&#039;"
#SecFilter "Content-Type\:"
&nbsp;
#catch smuggling attacks
#SecFilter "^(GET|POST).*Host:.*^(GET|POST)"  "id:300012,rev:1,severity:4,msg:&#039;catch smuggling attacks&#039;"
&nbsp;
#XSS insertion into Content-Type
#SecFilterSelective THE_REQUEST "Content-Type\:.*(&lt;[[:space:]]*(script|about|applet|activex|chrome)*&gt;.*(script|about|applet|activex|chrome)[[:space:]]*&gt;|onmouseover=|javascript\:)" "id:300002,rev:1,severity:4,msg:&#039;XSS attack in Content-type header&#039;"
&nbsp;
#Code injection via content length
#SecFilterSelective HTTP_Content-Length|HTTP_USER_AGENT "\;(system|passthru|exec)\(" "id:330003,rev:1,severity:4,msg:&#039;Code Injection in Content-Length header&#039;"
&nbsp;
#Don&#039;t accept chunked encodings modsecurity can not look at these, so this is a hole that can bypass your rules, the rule before this one should cover this, but hey paranoia is cheap
#SecFilterSelective HTTP_Transfer-Encoding "chunked" "id:300003,rev:1,severity:4,msg:&#039;Chunked Transfer Encoding denied&#039;"
&nbsp;
##generic recursion signatures
#SecFilterSelective REQUEST_URI "\.\./\.\./" "id:300004,rev:2,severity:4,msg:&#039;Generic Path Recursion1 denied&#039;"
#SecFilterSelective THE_REQUEST "\.\|\./\.\|\./\.\|" "id:300005,rev:1,severity:4,msg:&#039;Generic Path Recursion2 denied&#039;"
#SecFilterSelective THE_REQUEST "\.\.\./" "id:300006,rev:1,severity:4,msg:&#039;Bogus Path denied&#039;"
&nbsp;
#Generic PHP exploit signatures
#SecFilterSelective REQUEST_URI "&lt;\?php (chr|fwrite|fopen|system|echr|passthru|popen|proc_open|shell_exec|exec|proc_nice|proc_terminate|proc_get_status|proc_close|pfsockopen|leak|apache_child_terminate|posix_kill|posix_mkfifo|posix_setpgid|posix_setsid|posix_setuid|phpinfo)\(.*\)\;" "id:330002,rev:1,severity:4,msg:&#039;Generic PHP exploit pattern denied&#039;"
&nbsp;
#Prevent SQL injection in cookies
##SecFilterSelective COOKIE_VALUES "((select|grant|delete|insert|drop|alter|replace|truncate|update|create|rename|describe)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]+[[:space:]]+(from|into|table|database|index|view)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]|UNION SELECT.*\&#039;.*\&#039;.*,[0-9].*INTO.*FROM)" "id:300011,rev:1,severity:4,msg:&#039;Generic SQL injection in cookie&#039;"
&nbsp;
#Prevent SQL injection in UA
##SecFilterSelective HTTP_USER_AGENT "((select|grant|delete|insert|drop|alter|replace|truncate|update|create|rename|describe)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]+[[:space:]]+(from|into|table|database|index|view)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]|UNION SELECT.*\&#039;.*\&#039;.*,[0-9].*INTO.*FROM)" "id:300012,rev:1,severity:4,msg:&#039;Generic SQL injection in User Agent header&#039;"
&nbsp;
# Generic filter to prevent SQL injection attacks
# Understand that all SQL filters are very limited and are very difficult to prevent false postives and negatives.
# Please report false positives/negatives to mike@gotroot.com
#SecFilter "((select|grant|delete|insert|drop|alter|replace|truncate|update|create|rename|describe)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]+[[:space:]]+(from|into|table|database|index|view)[[:space:]]+[A-Z|a-z|0-9|\*| |\,]|UNION SELECT.*\&#039;.*\&#039;.*,[0-9].*INTO.*FROM)" "id:300013,rev:1,severity:4,msg:&#039;Generic SQL injection protection&#039;"
&nbsp;
#generic XSS PHP attack types
##SecFilterSelective REQUEST_URI "\.php\?" "chain,id:300010,rev:1,severity:4,msg:&#039;Generic PHP XSS exploit pattern denied&#039;"
#SecFilter "(javascript\:/(.*new\x20ActiveXObject.*Sh\.regwrite|.*window\.opener\.document\.body.\innerHTML=window\.opener\.document\.body\.innerHTML\.replace)|onmouseover=\&#039;javascript)"
&nbsp;
#Generic XSS filter
#please report false positives
##SecFilterSelective REQUEST_URI "!/mt\.cgi" "chain,msg:&#039;XSS2&#039;"
#SecFilter "&lt;[[:space:]]*(script|about|applet|activex|chrome)*&gt;.*(script|about|applet|activex|chrome)[[:space:]]*&gt;"
&nbsp;
#XSS in referrer and UA headers
##SecFilterSelective HTTP_REFERER|HTTP_USER_AGENT "&lt;[[:space:]]*(script|about|applet|activex|chrome)*&gt;.*(script|about|applet|activex|chrome)[[:space:]]*&gt;" "msg:&#039;XSS3&#039;"
&nbsp;
#HTTP header PHP code injection attacks
##SecFilterSelective HTTP_CLIENT_IP|HTTP_USER_AGENT|HTTP_Referer "(&lt;\?php|&lt;[[:space:]]?\?[[:space:]]?php|&lt;\? php)" "msg:&#039;PHP1&#039;"
&nbsp;
#Generic PHP remote file injection
##SecFilterSelective REQUEST_URI "!(/do_command)" "chain,msg:&#039;PHP2&#039;"
##SecFilterSelective REQUEST_URI "\.php\?.*=(https?|ftp)\:/.*(cmd|command)="
&nbsp;
#script, perl, etc. code in HTTP_Referer string
##SecFilterSelective HTTP_Referer "\#\!.*/" "msg:&#039;perl script1&#039;"
&nbsp;
#remote file inclusion generic attack signature
#SecFilterSelective THE_REQUEST  "\.(dat|gif|jpg|png|bmp|txt|vir|dot)\?" "chain,msg:&#039;remote 1&#039;"
#SecFilter "((name|pm_path|pagina|path|include_location|root|page|open)=(http|https|ftp)|(cmd|command|inc)=)"
&nbsp;
#remote file inclusion generic attack signature
#SecFilterSelective THE_REQUEST  "\.(dat|gif|jpg|png|bmp|txt|vir|dot)\?\&amp;(cmd|command|inc|name)=" "msg:&#039;remote2&#039;"
&nbsp;
#remote file inclusion generic attack signature
#SecFilterSelective ARGS  "\.(dat|gif|jpg|png|bmp|txt|vir|dot)" "chain,msg:&#039;file inclusion1&#039;"
#SecFilter "\?\&amp;(cmd|inc|name)="
&nbsp;
#remote file inclusion generic attack signature
#SecFilterSelective ARGS  "\.(dat|gif|jpg|png|bmp|txt|vir|dot)\?\&amp;(cmd|inc|name)=" "msg:&#039;file inclusion2&#039;"
&nbsp;
#remote file inclusion generic attack signature
#SecFilterSelective REQUEST_URI  "\.php\?.*=(http|https|ftp)\:/.*\?&amp;cmd=" "msg:&#039;file inclusion3&#039;"
&nbsp;
#Bogus file extensions generic signature
#SecFilterSelective THE_REQUEST  "[A-Za-z0-9]\.(gif|jpg|png|bmp)\.txt" "msg:&#039;file extension&#039;"
&nbsp;
#PHP remote path attach generic signature
#SecFilterSelective REQUEST_URI  "\.ph(p(3|4)?).*path=(http|https|ftp)\:/" "msg:&#039;remote path1&#039;"
#SecFilterSelective REQUEST_URI  "\.php.*path=(http|https|ftp)\:/" "msg:&#039;remote path2&#039;"
&nbsp;
#generic php attack sigs
#SecFilterSelective REQUEST_URI "(&amp;(cmd|command)=(id|uname)\x20|cmd\?(cmd|command)=|(spy|cmd|cmd_out|sh)\.(gif|jpg|png|bmp|txt)\?&amp;(cmd|command)=|\.php\?&amp;(cmd|command)=)" "msg:&#039;php attack1&#039;"
&nbsp;
# WEB-MISC apache directory disclosure attempt
#SecFilterSelective THE_REQUEST "////" "msg:&#039;apache directory disclosure&#039;"
&nbsp;
#PHP defenses
##SecFilterSelective ARG_PHPSESSID "!^$" "msg:&#039;something in phpsessid&#039;"
##SecFilterSelective COOKIE_PHPSESSID "!^$" "msg:&#039;something in cookie phpsessid&#039;"
&nbsp;
#PHP defenses
##SecFilterSelective COOKIE_ASKAPACHEID "!^[0-9a-z]*$" "msg:&#039;bad value for cookie&#039;"
&nbsp;
#cross site scripting attempt TYPE + JAVASCRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]text\/javascript" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt STYLE + JAVASCRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]application\/x-javascript" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt STYLE + JSCRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]text\/jscript" "msg:&#039;cross-site1&#039;"
&nbsp;
# cross site scripting attempt STYLE + VBSCRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]text\/vbscript" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt STYLE + VBSCRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]application\/x-vbscript" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt STYLE + ECMACRIPT
##SecFilterSelective THE_REQUEST "TYPE\s*=\s*[\&#039;\"]text\/ecmascript" "msg:&#039;cross-site1&#039;"
&nbsp;
# cross site scripting attempt STYLE + EXPRESSION
##SecFilterSelective THE_REQUEST "STYLE[\s]*=[\s]*[^&gt;]expression[\s]*\(" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt STYLE + EXPRESSION
##SecFilterSelective THE_REQUEST "[\s]*expression[\s]*\([^}]}[\s]*&lt;\/STYLE&gt;" "msg:&#039;cross-site1&#039;"
&nbsp;
# cross site scripting attempt using XML
##SecFilterSelective THE_REQUEST "&lt;!\[CDATA\[&lt;\]\]&gt;SCRIPT" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt executing hidden Javascript
##SecFilterSelective THE_REQUEST "eval[\s]*\([\s]*[^\.]\.innerHTML[\s]*\)" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt executing hidden Javascript
##SecFilterSelective THE_REQUEST "window\.execScript[\s]*\(" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting attempt to execute Javascript code
###SecFilterSelective THE_REQUEST "/(((URL|SRC|HREF|LOWSRC)[\s]*=)|(url[\s]*[\(]))[\s]*[\&#039;\"]*javascript[\:]" "msg:&#039;cross-site1&#039;"
&nbsp;
#cross site scripting HTML Image tag set to javascript attempt
#SecFilterSelective THE_REQUEST "img src=javascript" "msg:&#039;cross-site1&#039;"
&nbsp;
#Fake image file shell attacvk
#SecFilterSelective HTTP_Content-Type "image/.*" "msg:&#039;image shell 1&#039;"
#SecFilterSelective POST_PAYLOAD "chr\(" "msg:&#039;image shell2&#039;"
&nbsp;
#bogus graphics file
#SecFilterSelective HTTP_Content-Disposition "\.php"  "chain,msg:&#039;bogus graphics&#039;"
#SecFilterSelective HTTP_Content-Type "(image/gif|image/jpg|image/png|image/bmp)"
&nbsp;
# Allow only letters, digits, underscore, and square brackets (for arrays)
# in variable names#
#SecFilterSelective ARGS_NAMES "!^[][a-zA-Z0-9_]+$"
&nbsp;
#---------------------------------------------
# reject keywords that appear in POST or GET
#=============================================
SecFilterSignatureAction "nolog,auditlog,deny,severity:6,status:403"
&nbsp;
SecFilterSelective REQUEST_URI  "^/.*/wp-comments-post\.php" "id:50200,msg:&#039;WORDPRESS SPAM bad wp-comments-post location&#039;"
&nbsp;
&lt;files wp-comments-post.php&gt;
# fail for empty comment fields
SecFilterSelective "ARG_comment_post_ID|ARG_submit" "^$" "id:50300,msg:&#039;WORDPRESS SPAM MISSING comment_post_ID&#039;"
SecFilterSelective "ARG_comment_post_ID" "!^[0-9]{1,6}$" "id:50301,msg:&#039;WORDPRESS SPAM BAD comment_post_ID&#039;"
SecFilterSelective "HTTP_Cookie" "^$" "id:50302,msg:&#039;WORDPRESS SPAM No cookie&#039;"
&nbsp;
##SecFilterSelective "comment_post_DI" "^$" "id:50310,msg:&#039;WORDPRESS SPAM MISSING comment_post_DI&#039;"
##SecFilterSelective "comment_post_DI" "!^[0-9]{1,2}$" "id:50311,msg:&#039;WORDPRESS SPAM MISSING comment_post_DI&#039;"
&lt;/files&gt;
&lt;pre&gt;
&nbsp;
&lt;h2&gt;MODSEC Continued.. Custom Anti-Spam (WordPress) I made&lt;/h2&gt;
&lt;pre&gt;
SecFilterSignatureAction "nolog,noauditlog,deny,severity:6,redirect:http://www.askapache.com/feed/"
SecFilterSelective ARGS|THE_REQUEST "00bp\.com|360\.yahoo|987mb\.com|Ambien|American airline" "id:50010,msg:&#039;SPAM 10&#039;
SecFilterSelective ARGS|THE_REQUEST "Ativan|Caresoprodol|Darvocet|Ephedra|Ephedrine" "id:50011,msg:&#039;SPAM 11&#039;
SecFilterSelective ARGS|THE_REQUEST "Gambling|Lexapro|Tramadol|Venlafaxine" "id:50012,msg:&#039;SPAM 12&#039;
SecFilterSelective ARGS|THE_REQUEST "\[URL=|abgood|acura|acyclovir|adderall" "id:50013,msg:&#039;SPAM 13&#039;
SecFilterSelective ARGS|THE_REQUEST "adipex|alcohol|alprazolam|amateur|amrit" "id:50014,msg:&#039;SPAM 14&#039;
SecFilterSelective ARGS|THE_REQUEST "anal sex|analfinder|angelina jolie|asshole|axspace\.com" "id:50015,msg:&#039;SPAM 15&#039;
SecFilterSelective ARGS|THE_REQUEST "baccarat|bankrupt|bikini|biotic|black jack|blowjob" "id:50016,msg:&#039;SPAM 16&#039;
SecFilterSelective ARGS|THE_REQUEST "blackjack|blog\.360|brutality|buddhism|butalbital" "id:50017,msg:&#039;SPAM 17&#039;
SecFilterSelective ARGS|THE_REQUEST "cadillac|canalis|card credit|card stud|carisoprodol" "id:50018,msg:&#039;SPAM 18&#039;
SecFilterSelective ARGS|THE_REQUEST "carmen|cash advance|cash credit|casino|catch\.com" "id:50019,msg:&#039;SPAM 19&#039;
SecFilterSelective ARGS|THE_REQUEST "celebrex|celexa|cellulite|cheap|cheerleader" "id:50020,msg:&#039;SPAM 20&#039;
SecFilterSelective ARGS|THE_REQUEST "chevrolet|child abuse|cialis|cigarette|cipro" "id:50021,msg:&#039;SPAM 21&#039;
SecFilterSelective ARGS|THE_REQUEST "citroen|claritin|cleavage|clomid|codeine" "id:50022,msg:&#039;SPAM 22&#039;
SecFilterSelective ARGS|THE_REQUEST "consulting23|craps online|credit card|credit debt|crestor" "id:50023,msg:&#039;SPAM 23&#039;
SecFilterSelective ARGS|THE_REQUEST "dealership|debt free|desnudas|diazepam|dick" "id:50024,msg:&#039;SPAM 24&#039;
SecFilterSelective ARGS|THE_REQUEST "dildo|drugstore|earrings|endometrioma|endowment" "id:50025,msg:&#039;SPAM 25&#039;
SecFilterSelective ARGS|THE_REQUEST "erotic|estrogen|fioricet|francaise|freehost\.com" "id:50026,msg:&#039;SPAM 26&#039;
SecFilterSelective ARGS|THE_REQUEST "freehostia|freemb\.com|fuck|geocities\.com|hacking myspace" "id:50027,msg:&#039;SPAM 27&#039;
SecFilterSelective ARGS|THE_REQUEST "holdem|honda|hotels|hydrocodone|hypnotic" "id:50028,msg:&#039;SPAM 28&#039;
SecFilterSelective ARGS|THE_REQUEST "hyundai|implants|incest|instant approval|insurance" "id:50029,msg:&#039;SPAM 29&#039;
SecFilterSelective ARGS|THE_REQUEST "interracial|jaguar|jenny movie|johanson|kasino" "id:50030,msg:&#039;SPAM 30&#039;
SecFilterSelective ARGS|THE_REQUEST "lesbian|levitra|lipitor|loan|lolita" "id:50031,msg:&#039;SPAM 31&#039;
SecFilterSelective ARGS|THE_REQUEST "lorazepam|lorcet|lyrics|madamic|majorette" "id:50032,msg:&#039;SPAM 32&#039;
SecFilterSelective ARGS|THE_REQUEST "malaria|mastercar|masturbate|masturbation|maturewomen" "id:50033,msg:&#039;SPAM 33&#039;
SecFilterSelective ARGS|THE_REQUEST "mazda|medication|medicine|megsfree5\.com|mercedes" "id:50034,msg:&#039;SPAM 34&#039;
SecFilterSelective ARGS|THE_REQUEST "meridia|metformin|mitsubishi|mortgage|myspace profile" "id:50035,msg:&#039;SPAM 35&#039;
SecFilterSelective ARGS|THE_REQUEST "naked|neocool|nexium|nimire\.com|nissan" "id:50036,msg:&#039;SPAM 36&#039;
SecFilterSelective ARGS|THE_REQUEST "nokia|nude|nudism|nymph|open toe" "id:50037,msg:&#039;SPAM 37&#039;
SecFilterSelective ARGS|THE_REQUEST "oprodol|orgasm|oxycodone|oxycontin|packages" "id:50038,msg:&#039;SPAM 38&#039;
SecFilterSelective ARGS|THE_REQUEST "painrelief|pantyhose|paxil|payday|penis" "id:50039,msg:&#039;SPAM 39&#039;
SecFilterSelective ARGS|THE_REQUEST "percocet|pharmacy|phentermine|phetermine|phpbb_root" "id:50040,msg:&#039;SPAM 40&#039;
SecFilterSelective ARGS|THE_REQUEST "pictaboo|pictorial|pills|pissing|play craps" "id:50041,msg:&#039;SPAM 41&#039;
SecFilterSelective ARGS|THE_REQUEST "playgirl|pocker web|poker|pontiac|poquer" "id:50042,msg:&#039;SPAM 42&#039;
SecFilterSelective ARGS|THE_REQUEST "porn|pounder|prescription|preteen|prevacid" "id:50043,msg:&#039;SPAM 43&#039;
SecFilterSelective ARGS|THE_REQUEST "price1|prilosec|propecia|proza|prozac" "id:50044,msg:&#039;SPAM 44&#039;
SecFilterSelective ARGS|THE_REQUEST "puddled|pussy|refinance|rentals|replica" "id:50045,msg:&#039;SPAM 45&#039;
SecFilterSelective ARGS|THE_REQUEST "ringtones|roulette|screensaver|seduced|sexual" "id:50046,msg:&#039;SPAM 46&#039;
SecFilterSelective ARGS|THE_REQUEST "sexy|shemale|shiloh|singulair|site-host" "id:50047,msg:&#039;SPAM 47&#039;
SecFilterSelective ARGS|THE_REQUEST "slot machine|slot maschine|slots machine|solpip\.com|soma" "id:50048,msg:&#039;SPAM 48&#039;
SecFilterSelective ARGS|THE_REQUEST "sperm|starlets|supplier|suzuki|tadalafil" "id:50049,msg:&#039;SPAM 49&#039;
SecFilterSelective ARGS|THE_REQUEST "toyota|tylenol|ultram|valium|viagra" "id:50050,msg:&#039;SPAM 50&#039;
SecFilterSelective ARGS|THE_REQUEST "vigora|vioxx|wallpaper|warez|webcam" "id:50051,msg:&#039;SPAM 51&#039;
SecFilterSelective ARGS|THE_REQUEST "webpages\.com|wellbutrin|whitesluts|wholesale|whore" "id:50052,msg:&#039;SPAM 52&#039;
SecFilterSelective ARGS|THE_REQUEST "windshield|xanax|xenical|y lohan|yourgirls" "id:50053,msg:&#039;SPAM 53&#039;
SecFilterSelective ARGS|THE_REQUEST "youtube\.com|zantac|sex offenders|hotgay|Zoloft|celtic women" "id:50054,msg:&#039;SPAM 54&#039;
SecFilterSelective ARGS|THE_REQUEST "dollhouse|freehot|kardashian|oralsex" "id:50055,msg:&#039;SPAM 55&#039;
SecFilterSelective ARGS|THE_REQUEST "freeimghost" "id:50056,msg:&#039;SPAM 56&#039;</pre>





<h2>Unreleased AskApache Lightning code - caching plugin for WordPress</h2>
<pre>RewriteEngine On
RewriteBase /
&nbsp;
RewriteCond %{REQUEST_URI} ^/(stats/|missing\.html|failed_auth\.html|test/).* [NC,OR]
RewriteCond %{ENV:REDIRECT_STATUS} =200
RewriteRule .* - [L]
&nbsp;
RewriteCond %{HTTP_HOST} !=www.askapache.com
RewriteCond %{HTTP_HOST} !=z.askapache.com
RewriteRule .? http://www.askapache.com%{REQUEST_URI}%{QUERY_STRING} [R=301,L]
&nbsp;
#RewriteCond %{HTTPS} =on
#RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ /(wp-login.php|wp-admin)(.*)\ HTTP/ [NC]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\ HTTP/ [NC]
#RewriteRule .* http://www.askapache.com/$1 [R=301,L]
&nbsp;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)%20(.+)\ HTTP/ [NC]
RewriteRule .* http://www.askapache.com/%1-%2 [R=301,L]
&nbsp;
RewriteCond %{THE_REQUEST} ^GET\ /valid-html/.*\ HTTP/ [NC]
RewriteCond %{HTTP_REFERER} ^https?://www.askapache.com(.+).*$ [NC]
RewriteRule .* http://validator.w3.org/check?uri=http://www.askapache.com%1;ss=1;outline=1;debug [R=307,L,NE]
&nbsp;
RewriteCond %{THE_REQUEST} ^GET\ /valid-css/.*\ HTTP/ [NC]
RewriteRule .* http://jigsaw.w3.org/css-validator/validator?uri=z.askapache.com/z/c/apache-10.css [R=301,L]
&nbsp;
RewriteCond %{THE_REQUEST} ^GET\ /search/.*\ HTTP/ [NC]
RewriteCond %{QUERY_STRING} ^s=(.+)$ [NC]
RewriteRule .* http://www.askapache.com/search/%1? [R=302,L]
&nbsp;
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/X%{REQUEST_URI}index.html -f
RewriteRule ^(.*)$ /X%{REQUEST_URI}index.html [L]
&nbsp;
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/X%{REQUEST_URI} -f
RewriteRule ^(.*)$ /X%{REQUEST_URI} [L]</pre>



<h2>Passing Parameters to CGI through HTTP Headers</h2>
<p>This deserves a note.. this trick lets you bypass so many hosting environment restrictions it's not even funny... like you can run bash as your webserver instead of apache!  (kinda...)</p>
<pre>RewriteCond %{REQUEST_URI} ^/cgi-bin/(hash|java)\.cgi$ [NC]
RewriteCond %{HTTP:P3P} ^(([^:]+):(.+))$ [NC]
RewriteRule .* - [E=HTTP_JS:%{HTTP:P3P},E=HTTP_US:%2,E=HTTP_PA:%3]</pre>



<h2>Redirect to FeedBurner</h2>
<p>Yes.. I was the first to do this (parse the real rewrites internally in wordpress for no bypassing possibilities)... </p>
<pre>#RewriteCond %{REQUEST_URI} ^/feed/.*?$ [NC,OR]
#RewriteCond %{HTTP_REFERER} ^https?://www.askapache.com/wp-admin(.+).*$ [NC]
RewriteCond %{HTTP_USER_AGENT} FeedBurner [NC]
RewriteRule .* - [S=1]
&nbsp;
RewriteCond %{REQUEST_URI} ^/(feed|rdf|rss|rss2|atom).* [NC,OR]
RewriteCond %{REQUEST_URI} ^/wp-(feed|rdf|rss|rss2|atom).* [NC,OR]
RewriteCond %{REQUEST_FILENAME} ^.*/(wp-atom|wp-feed|wp-rdf|wp-rss|wp-rss2)\.php$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} ^.*/wp-includes/feed[^\.]*\.php$ [NC,OR]
RewriteCond %{QUERY_STRING} .*(feed|rdf|rss|rss2|atom).* [NC]
RewriteRule .* http://feeds.askapache.com/apache/htaccess? [R=302,L]</pre>
































<h2>More Unreleased Caching Tests</h2>
<pre># +ASKAPACHE CRAZYCACHE 2.3
#######################################################
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# +ACACHE RULES
# +RULE
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ //?(.+)\.rdf\ HTTP/ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-cache/%2.html/index.rdf -f
RewriteRule ^(.+)\.rdf$ /wp-cache/%2.html/index.rdf [L,S=3]
&nbsp;
RewriteCond %{QUERY_STRING} !^.*cacheit.* [NC]
#RewriteCond %{HTTP_USER_AGENT} W3C_Validator [OR,NC]
#RewriteCond %{REMOTE_ADDR} = [OR]
&nbsp;
RewriteCond %{REQUEST_METHOD} =POST [OR]
RewriteCond %{THE_REQUEST} ^$ [OR]
RewriteCond %{QUERY_STRING} nocache [OR]
RewriteCond %{REMOTE_ADDR} = [OR]
RewriteCond %{HTTP_COOKIE} ^.*wordpress_logged_in_.*$ [NC]
RewriteRule .+ - [S=2]
&nbsp;
RewriteCond %{DOCUMENT_ROOT}/wp-cache%{REQUEST_URI} !-d
RewriteRule .+ - [S=1]
&nbsp;
RewriteCond %{DOCUMENT_ROOT}/wp-cache%{REQUEST_URI}/index.html -f
RewriteRule .+ /wp-cache%{REQUEST_URI}/index.html [L]
# -RULE
# -ACACHE RULES
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
#######################################################
# -ASKAPACHE CRAZYCACHE 2.3
&nbsp;
# +ASKAPACHE CRAZYCACHE 2.3
#######################################################
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
# +ACACHE RULES
# +RULE
FileETag None
AddOutputFilterByType DEFLATE text/html
&nbsp;
AddType &#039;text/html; charset=UTF-8&#039; .html
&nbsp;
Header set P3P "policyref=\"http://www.askapache.com/w3c/p3p.xml\""
Header set X-Pingback "http://www.askapache.com/xmlrpc.php"
Header set Content-Language "en-US"
Header set Vary "Accept-Encoding,Accept"
&nbsp;
&lt;ifModule mod_expires.c&gt;
ExpiresActive On
ExpiresDefault M7200
&lt;/ifModule&gt;
# -RULE
# -ACACHE RULES
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
#               __                          __
#   ____ ______/ /______ _____  ____ ______/ /_  ___
#  / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \
# / /_/ (__  ) ,&lt; / /_/ / /_/ / /_/ / /__/ / / /  __/
# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/
#                     /_/
#######################################################
# -ASKAPACHE CRAZYCACHE 2.3
&nbsp;
Options +IndexesOptions +FollowSymLinks
AddHandler application/x-httpd-php .php
&nbsp;
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !^tyy+$ [NC]
RewriteCond %{REMOTE_USER} ^(.+)$
RewriteRule ^(.*)$ $1/-%1 [R=302,L]
Options +FollowSymLinks
DirectoryIndex index.php
ErrorDocument 404 /cgi-bin/pro/index.php
&nbsp;
AuthName "Protection"
AuthUserFile /home/askapache/sites/askapache.com/.htpasswda1
AuthGroupFile /dev/null
AuthType Basic
Require valid-user
Satisfy Any
&nbsp;
&lt;ifModule mod_security.c&gt;
SecFilterEngine Off
&lt;/ifModule&gt;
Options +ExecCGI -Indexes -Includes +FollowSymLinks
Order Deny,Allow
Deny from All
Allow from 208.113.134.190 64.111.114.111  env=REDIRECT_STATUS
&nbsp;
#SetEnvIf Remote_Addr ^$ MODSEC_ENABLE=Off
#SetEnvIf Server_Addr ^$ MODSEC_ENABLE=Off
#SetEnvIf Remote_Addr ^({SERVER_ADDR}e)$ GOOD=$1
#SetEnvIf Server_Addr GOOD R</pre>


<h2>Default HTACCESS</h2>
<pre>#
# Directives controlling the display of server-generated directory listings.
#
# Required modules: mod_autoindex, mod_alias
#
# To see the listing of a directory, the Options directive for the
# directory must include "Indexes", and the directory must not contain
# a file matching those listed in the DirectoryIndex directive.
#
Options +Indexes +MultiViews -ExecCGI +FollowSymLinks
DirectoryIndex index.html
&nbsp;
#
#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
#
IndexOptions FancyIndexing IconHeight=22 IconWidth=20 IgnoreClient NameWidth=* DescriptionWidth=* ScanHTMLTitles SuppressLastModified XHTML FoldersFirst SuppressHTMLPreamble
&nbsp;
#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions.  These are only displayed for
# FancyIndexed directories.
#
&nbsp;
AddIconByEncoding (CMP,http://z.askapache.com/i/s/compressed.gif) x-compress x-gzip
&nbsp;
AddIconByType (IMG,http://z.askapache.com/i/s/image.gif) image/*
AddIconByType (SND,http://z.askapache.com/i/s/sound2.gif) audio/*
AddIconByType (TXT,http://z.askapache.com/i/s/text.gif) text/*
AddIconByType (VID,http://z.askapache.com/i/s/movie.gif) video/*
&nbsp;
AddIcon http://z.askapache.com/i/s/hand.right.gif README
AddIcon http://z.askapache.com/i/s/folder.gif ^^DIRECTORY^^
AddIcon http://z.askapache.com/i/s/dir.png ^^DIRECTORY^^
AddIcon http://z.askapache.com/i/s/blank.gif ^^BLANKICON^^
AddDescription "100 Continue" 100* 100/index.html
AddDescription "101 Switching Protocols" 101* 101/index.html
AddDescription "102 Processing" 102* 102/index.html
AddDescription "200 OK" 200* 200/index.html
AddDescription "201 Created" 201* 201/index.html
AddDescription "202 Accepted" 202* 202/index.html
AddDescription "203 Non-Authoritative Information" 203* 203/index.html
AddDescription "204 No Content" 204* 204/index.html
AddDescription "205 Reset Content" 205* 205/index.html
AddDescription "206 Partial Content" 206* 206/index.html
AddDescription "207 Multi-Status" 207* 207/index.html
AddDescription "300 Multiple Choices" 300* 300/index.html
AddDescription "301 Moved Permanently" 301* 301/index.html
AddDescription "302 Found" 302* 302/index.html
AddDescription "303 See Other" 303* 303/index.html
AddDescription "304 Not Modified" 304* 304/index.html
AddDescription "305 Use Proxy" 305* 305/index.html
AddDescription "306 unused" 306* 306/index.html
AddDescription "307 Temporary Redirect" 307* 307/index.html
AddDescription "400 Bad Request" 400* 400/index.html
AddDescription "401 Authorization Required" 401* 401/index.html
AddDescription "402 Payment Required" 402* 402/index.html
AddDescription "403 Forbidden" 403* 403/index.html
AddDescription "404 Not Found" 404* 404/index.html
AddDescription "405 Method Not Allowed" 405* 405/index.html
AddDescription "406 Not Acceptable" 406* 406/index.html
AddDescription "407 Proxy Authentication Required" 407* 407/index.html
AddDescription "408 Request Time-out" 408* 408/index.html
AddDescription "409 Conflict" 409* 409/index.html
AddDescription "410 Gone" 410* 410/index.html
AddDescription "411 Length Required" 411* 411/index.html
AddDescription "412 Precondition Failed" 412* 412/index.html
AddDescription "413 Request Entity Too Large" 413* 413/index.html
AddDescription "414 Request-URI Too Large" 414* 414/index.html
AddDescription "415 Unsupported Media Type" 415* 415/index.html
AddDescription "416 Requested Range Not Satisfiable" 416* 416/index.html
AddDescription "417 Expectation Failed" 417* 417/index.html
AddDescription "418 unused" 418* 418/index.html
AddDescription "419 unused" 419* 419/index.html
AddDescription "420 unused" 420* 420/index.html
AddDescription "421 unused" 421* 421/index.html
AddDescription "422 Unprocessable Entity" 422* 422/index.html
AddDescription "423 Locked" 423* 423/index.html
AddDescription "424 Failed Dependency" 424* 424/index.html
AddDescription "425 No code" 425* 425/index.html
AddDescription "426 Upgrade Required" 426* 426/index.html
AddDescription "500 Internal Server Error" 500* 500/index.html
AddDescription "501 Method Not Implemented" 501* 501/index.html
AddDescription "502 Bad Gateway" 502* 502/index.html
AddDescription "503 Service Temporarily Unavailable" 503* 503/index.html
AddDescription "504 Gateway Time-out" 504* 504/index.html
AddDescription "505 HTTP Version Not Supported" 505* 505/index.html
AddDescription "506 Variant Also Negotiates" 506* 506/index.html
AddDescription "507 Insufficient Storage" 507* 507/index.html
AddDescription "508 unused" 508* 508/index.html
AddDescription "509 unused" 509* 509/index.html
AddDescription "510 Not Extended" 510* 510/index.html
AddDescription ".htaccess ErrorDocuments" *
&nbsp;
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
ReadmeName /X/error/README.html
HeaderName /X/error/HEADER.html
&nbsp;
# DefaultIcon is which icon to show for where none is explicitly set.
DefaultIcon http://z.askapache.com/i/s/generic.gif</pre>


<h2>Ok I'm done commenting..</h2>
<pre>#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing.  Shell-style wildcarding is permitted.
#
IndexIgnore .??*  *_notes *~
RewriteEngine On
RewriteCond %{HTTPS} !=on [NC]
RewriteRule .* https://www.askapache.com%{REQUEST_URI}
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},E=REMOTE_USER:%{HTTP:Authorization}]
&nbsp;
#RewriteCond %{QUERY_STRING} openid.mode=authorize
#RewriteCond %{REQUEST_URI} ^/openid.*$ [NC]
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},E=REMOTE_USER:%{HTTP:Authorization}]
Options +FollowSymLinks
DirectoryIndex index.html
&nbsp;
#SetEnvIfNoCase ^Cookie$ "(.*)" HTTP_MY_COOKIE=$1
#SetEnvIfNoCase Remote_Addr "(.*)" HTTP_MY_REMOTE_ADDR=$1
ExpiresActive Off
FileETag None
Header unset Connection
Header set Connection "close"
Header unset Last-Modified
Header unset ETag
Header unset Accept-Ranges
Header unset Vary
Header unset Content-Type
Header unset X-Pingback
Header unset P3P
#Header add RouterBits "%D %t"
#Header add Location "http://www.askapache.com/feed/"
#Header add Found "http://askapache.com/feed/"
#Header add Content-Location "http://www.askapache.com/feed/"
#Header add Refresh "http://www.askapache.com/feed/"
#Header set Hi "%{HTTP_MY_REMOTE_ADDR}e"
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#
#
# TZ: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
SetEnv TZ America/Indianapolis
&nbsp;
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
SetEnv SERVER_ADMIN webmaster@askapache.com
&nbsp;
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.0/mod/core.html#options
# for more information.
#
Options  +FollowSymLinks -ExecCGI -Indexes -Includes -MultiViews
&nbsp;
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.html index.php /index.php
&nbsp;
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
&lt;filesMatch "^\.ht"&gt;
    Order allow,deny
    Deny from all
  Satisfy All
&lt;/filesMatch&gt;
&nbsp;
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/html
&nbsp;
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature Off
&nbsp;
##############################################
#           HEADERS and CACHING              #
##############################################
Header unset Pragma
Header unset Last-Modified
FileETag None
&nbsp;
Redirect 400 /e/400
Redirect 401 /e/401
Redirect 402 /e/402
Redirect 403 /e/403
Redirect 404 /e/404
Redirect 405 /e/405
Redirect 406 /e/406
Redirect 407 /e/407
Redirect 408 /e/408
Redirect 409 /e/409
Redirect 410 /e/410
Redirect 411 /e/411
Redirect 412 /e/412
Redirect 413 /e/413
Redirect 414 /e/414
Redirect 415 /e/415
Redirect 416 /e/416
Redirect 417 /e/417
Redirect 418 /e/418
Redirect 419 /e/419
Redirect 420 /e/420
Redirect 421 /e/421
Redirect 422 /e/422
Redirect 423 /e/423
Redirect 424 /e/424
Redirect 425 /e/425
Redirect 426 /e/426
Redirect 500 /e/500
Redirect 501 /e/501
Redirect 502 /e/502
Redirect 503 /e/503
Redirect 504 /e/504
Redirect 505 /e/505
Redirect 506 /e/506
Redirect 507 /e/507
Redirect 508 /e/508
Redirect 509 /e/509
Redirect 510 /e/510
&nbsp;
#
# Redirect allows you to tell clients about documents which used to exist in
# your server&#039;s namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
##############################################
#          PERMANENT REDIRECTS               #
##############################################
Redirect 301 /12-lessons-for-those-afraid-of-css.html http://www.askapache.com/css/12-lessons-for-those-afraid-of-css.html
Redirect 301 /2006/htaccess/htaccesselite-ultimate-htaccess-article.html http://www.askapache.com/htaccess/apache-htaccess.html
Redirect 301 /2007/phpbb/sending-post-form-data-with-php-curl.html http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html http://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html
Redirect 301 /2007/webmaster/php-and-ajax-shell-console.html http://www.askapache.com/tools/php-and-ajax-shell-console.html
Redirect 301 /27-request-methods-for-use-with-apache-and-rewritecond-and-htaccess.html http://www.askapache.com/htaccess/27-request-methods-for-use-with-apache-and-rewritecond-and-htaccess.html
Redirect 301 /404-google-wordpress-plugin.html http://www.askapache.com/seo/404-google-wordpress-plugin.html
Redirect 301 /503-service-temporarily-unavailable.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /Overview-about.rdf http://www.askapache.com/askapache-home.rdf
Redirect 301 /abbr-acronym.html http://www.askapache.com/xhtml/abbr-acronym.html
Redirect 301 /adsense-robots.html http://www.askapache.com/google/adsense-robots.html
Redirect 301 /alexa-toolbar-firefox.html http://www.askapache.com/tools/alexa-toolbar-firefox.html
Redirect 301 /allowing-access-from-1-static-ip-and-deny-the-rest.html http://www.askapache.com/htaccess/apache-htaccess.html
Redirect 301 /anti-virus-spyware-rootkit.html http://www.askapache.com/security/anti-virus-spyware-rootkit.html
Redirect 301 /apache-ssl-in-htaccess-examples.html http://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples.html
Redirect 301 /awk-tutorial.html http://www.askapache.com/awk/awk-tutorial.html
Redirect 301 /best-adsense-optimization.html http://www.askapache.com/wordpress/best-adsense-optimization.html
Redirect 301 /commonly-used-htaccess-code-examples.html http://www.askapache.com/htaccess/commonly-used-htaccess-code-examples.html
Redirect 301 /css-background-image-sprite.html http://www.askapache.com/css/css-background-image-sprite.html
Redirect 301 /css-browser-screenshots.html http://www.askapache.com/tools/css-browser-screenshots.html
Redirect 301 /css-class-example.html http://www.askapache.com/css/css-class-example.html
Redirect 301 /curl-multi-downloads.html http://www.askapache.com/php/curl-multi-downloads.html
Redirect 301 /custom-boot-menu-in-windows-xp.html http://www.askapache.com/windows/custom-boot-menu-in-windows-xp.html
Redirect 301 /donate http://www.dreamhost.com/donate.cgi?id=8261
Redirect 301 /donate/ http://www.dreamhost.com/donate.cgi?id=8261
Redirect 301 /htaccess.txt http://z.askapache.com/p/htaccess.txt
Redirect 301 /htaccess/404-errorpages.html http://www.askapache.com/seo/google-ajax-search-seo-tips.html
Redirect 301 /htaccess/feedsmith http://www.askapache.com/htaccess/feedsmith-htaccess.html
Redirect 301 /htaccess/http-status-codes.html http://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html
Redirect 301 /htaccess/instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /htaccess/speed-up-the-apache-web-server-with-configuration-hacks.html http://www.askapache.com/htaccess/apache-web-server-speed-configuration-hacks.html
Redirect 301 /instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html http://www.askapache.com/htaccess/503-service-temporarily-unavailable.html
Redirect 301 /security/bypassing-vlan.html http://www.askapache.com/security/hacking-vlan-switched-networks.html
Redirect 301 /security/bypassing-vlanbypassing-vlan.html http://www.askapache.com/security/hacking-vlan-switched-networks.html
Redirect 301 /security/rigging-the-dreamhost-site-of-the-month-contest.html http://www.askapache.com/dreamhost/rigging-the-dreamhost-site-of-the-month-contest.html
Redirect 301 /seo/tailrankcom-robot.html http://www.askapache.com/seo/tailrank-robot.html
Redirect 301 /webmaster/caching-tutorial-for-webmasters.html http://www.askapache.com/htaccess/caching-tutorial-for-webmasters.html
Redirect 301 /webmaster/lft-traceroute-tool.html http://www.askapache.com/tools/lft-traceroute-tool.html
&nbsp;
##############################################
#          PERMANENT REDIRECTMATCH           #
##############################################
#RedirectMatch 301 ^/&amp;(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/&amp;amp(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/([^/]+)//$ http://www.askapache.com/$1/
RedirectMatch 301 ^/(.+)/htaccesselite-ultimate-htaccess-article.html(.*) http://www.askapache.com/htaccess/apache-htaccess.html
RedirectMatch 301 ^/(.+)\.html/([a-z][a-z])/$ http://www.askapache.com/$1.html
RedirectMatch 301 ^/([\(]+)(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/([^9]*)9O1X.3y(.*)/(.*)$ http://www.askapache.com/$2
RedirectMatch 301 ^/.3y(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/200([0-9])/([0-9])(.*)$ http://www.askapache.com/top-100/
RedirectMatch 301 ^/200([0-9])/([^01])(.*)$ http://www.askapache.com/$2$3
RedirectMatch 301 ^/about/glossary(.*)$ http://www.askapache.com/glossary$1
RedirectMatch 301 ^/apache-speed(.*)$ http://www.askapache.com/htaccess/apache-speed$1
RedirectMatch 301 ^/category/(.+)$ http://www.askapache.com/$1
RedirectMatch 301 ^/docs/(.*)$ http://askapache.info/$1
RedirectMatch 301 ^/htaccess/feedsmith-htaccess(.*) http://www.askapache.com/htaccess/redirecting-wordpress-feeds-to-feedburner.html
RedirectMatch 301 ^/robots-txt(.*)$ http://www.askapache.com/robots.txt
#RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://z.askapache.com/uploads/$1
RedirectMatch 301 ^/z/(.+)$ http://z.askapache.com/$1
RedirectMatch 301 ^/(z|t|i|j|c|p)/(.*)$ http://z.askapache.com/$1/$2
RedirectMatch 301 ^/hosting/?$ http://www.askapache.com/hosting/
&nbsp;
##############################################
#          TEMPORARY REDIRECTMATCH           #
##############################################
RedirectMatch 307 ^/getflash/?$ http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash
RedirectMatch 307 ^/dream/?$ http://www.askapache.com/dreamhost/
RedirectMatch 307 ^/(cse|apachecse|apachecsetest|apachesearch)/?$ http://www.google.com/coop/cse?cx=002660089121042511758%3Akk7rwc2gx0i
&nbsp;
#
# Commonly used filename extensions to character sets. You probably
# want to avoid clashes with the language extensions, unless you
# are good at carefully testing your setup after each change.
# See http://www.iana.org/assignments/character-sets for the
# official list of charset names and their respective RFCs.
#
AddDefaultCharset UTF-8
&nbsp;
#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
#
AddType &#039;application/rdf+xml; charset=UTF-8&#039; .rdf
AddType &#039;application/xhtml+xml; charset=UTF-8&#039; .xhtml
AddType &#039;application/xhtml+xml; charset=UTF-8&#039; .xhtml.gz
AddType &#039;text/html; charset=UTF-8&#039; .html
AddType &#039;text/html; charset=UTF-8&#039; .html.gz
AddType application/octet-stream .rar .chm .bz2 .tgz .msi .pdf .exe
AddType application/vnd.ms-excel .csv
AddType application/x-httpd-php-source .phps
AddType application/x-pilot .prc .pdb
AddType application/x-shockwave-flash .swf
AddType application/xrds+xml .xrdf
AddType text/plain .ini .sh .bsh .bash .awk .nawk .gawk .csh .var .c .in .h .asc .md5 .sha .sha1
AddType video/x-flv .flv
&nbsp;
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
&nbsp;
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler php-cgi .php
&nbsp;
#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
Action php-cgi /cgi-bin/php.cgi
&nbsp;
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
#100 Continue
#101 Switching Protocols
#102 Processing
#200 OK
#201 Created
#202 Accepted
#203 Non-Authoritative Information
#204 No Content
#205 Reset Content
#206 Partial Content
#207 Multi-Status
#300 Multiple Choices
#301 Moved Permanently
#302 Found
#303 See Other
#304 Not Modified
#305 Use Proxy
#306 unused
#307 Temporary Redirect
#400 Bad Request
#401 Authorization Required
#402 Payment Required
#403 Forbidden
#404 Not Found
#405 Method Not Allowed
#406 Not Acceptable
#407 Proxy Authentication Required
#408 Request Time-out
#409 Conflict
#410 Gone
#411 Length Required
#412 Precondition Failed
#413 Request Entity Too Large
#414 Request-URI Too Large
#415 Unsupported Media Type
#416 Requested Range Not Satisfiable
#417 Expectation Failed
#418 unused
#419 unused
#420 unused
#421 unused
#422 Unprocessable Entity
#423 Locked
#424 Failed Dependency
#425 No code
#426 Upgrade Required
#500 Internal Server Error
#501 Method Not Implemented
#502 Bad Gateway
#503 Service Temporarily Unavailable
#504 Gateway Time-out
#505 HTTP Version Not Supported
#506 Variant Also Negotiates
#507 Insufficient Storage
#508 unused
#509 unused
#510 Not Extended
&nbsp;
#ErrorDocument 100 /X/err/1/HTTP_CONTINUE.html
#ErrorDocument 101 /X/err/1/HTTP_SWITCHING_PROTOCOLS.html
#ErrorDocument 102 /X/err/1/HTTP_PROCESSING.html
&nbsp;
#ErrorDocument 200 /X/err/2/HTTP_OK.html
#ErrorDocument 201 /X/err/2/HTTP_CREATED.html
#ErrorDocument 202 /X/err/2/HTTP_ACCEPTED.html
#ErrorDocument 203 /X/err/2/HTTP_NON_AUTHORITATIVE.html
#ErrorDocument 204 /X/err/2/HTTP_NO_CONTENT.html
#ErrorDocument 205 /X/err/2/HTTP_RESET_CONTENT.html
#ErrorDocument 206 /X/err/2/HTTP_PARTIAL_CONTENT.html
#ErrorDocument 207 /X/err/2/HTTP_MULTI_STATUS.html
&nbsp;
#ErrorDocument 300 /X/err/HTTP_MULTIPLE_CHOICES.html
#ErrorDocument 301 /X/err/HTTP_MOVED_PERMANENTLY.html
#ErrorDocument 302 /X/err/HTTP_MOVED_TEMPORARILY.html
#ErrorDocument 303 /X/err/HTTP_SEE_OTHER.html
#ErrorDocument 304 /X/err/HTTP_NOT_MODIFIED.html
#ErrorDocument 305 /X/err/HTTP_USE_PROXY.html
#ErrorDocument 307 /X/err/HTTP_TEMPORARY_REDIRECT.html
#ErrorDocument 404 /X/err/HTTP_NOT_FOUND.html
&nbsp;
ErrorDocument 400 /X/err/4/HTTP_BAD_REQUEST.html
ErrorDocument 401 /X/err/4/HTTP_UNAUTHORIZED.html
ErrorDocument 402 /X/err/4/HTTP_PAYMENT_REQUIRED.html
ErrorDocument 403 /X/err/4/HTTP_FORBIDDEN.html
ErrorDocument 405 /X/err/4/HTTP_METHOD_NOT_ALLOWED.html
ErrorDocument 406 /X/err/4/HTTP_NOT_ACCEPTABLE.html
ErrorDocument 407 /X/err/4/HTTP_PROXY_AUTHENTICATION_REQUIRED.html
ErrorDocument 408 /X/err/4/HTTP_REQUEST_TIME_OUT.html
ErrorDocument 409 /X/err/4/HTTP_CONFLICT.html
ErrorDocument 410 /X/err/4/HTTP_GONE.html
ErrorDocument 411 /X/err/4/HTTP_LENGTH_REQUIRED.html
ErrorDocument 412 /X/err/4/HTTP_PRECONDITION_FAILED.html
ErrorDocument 413 /X/err/4/HTTP_REQUEST_ENTITY_TOO_LARGE.html
ErrorDocument 414 /X/err/4/HTTP_REQUEST_URI_TOO_LARGE.html
ErrorDocument 415 /X/err/4/TTP_UNSUPPORTED_MEDIA_TYPE.html
ErrorDocument 416 /X/err/4/HTTP_RANGE_NOT_SATISFIABLE.html
ErrorDocument 417 /X/err/4/HTTP_EXPECTATION_FAILED.html
ErrorDocument 422 /X/err/4/HTTP_UNPROCESSABLE_ENTITY.html
ErrorDocument 423 /X/err/4/HTTP_LOCKED.html
ErrorDocument 424 /X/err/4/HTTP_FAILED_DEPENDENCY.html
ErrorDocument 426 /X/err/4/HTTP_UPGRADE_REQUIRED.html
&nbsp;
ErrorDocument 500 /X/err/5/HTTP_INTERNAL_SERVER_ERROR.html
ErrorDocument 501 /X/err/5/HTTP_NOT_IMPLEMENTED.html
ErrorDocument 502 /X/err/5/HTTP_BAD_GATEWAY.html
ErrorDocument 503 /X/err/5/HTTP_SERVICE_UNAVAILABLE.html
ErrorDocument 504 /X/err/5/HTTP_GATEWAY_TIME_OUT.html
ErrorDocument 505 /X/err/5/HTTP_VERSION_NOT_SUPPORTED.html
ErrorDocument 506 /X/err/5/HTTP_VARIANT_ALSO_VARIES.html
ErrorDocument 507 /X/err/5/HTTP_INSUFFICIENT_STORAGE.html
ErrorDocument 510 /X/err/5/HTTP_NOT_EXTENDED.html
ErrorDocument 404 /index.php?error=404
&nbsp;
# 1 YEAR
&lt;filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"&gt;
Header unset P3P
Header set Cache-Control "public"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
&lt;/filesMatch&gt;
&nbsp;
# 2 HOURS
&lt;filesMatch "\.(html|htm|xml|txt|xsl)$"&gt;
&lt;ifModule mod_expires.c&gt;
ExpiresActive On
ExpiresDefault A3600
&lt;/ifModule&gt;
&lt;/filesMatch&gt;
&nbsp;
RewriteEngine On
RewriteBase /
&nbsp;
RewriteCond %{ENV:REDIRECT_STATUS} =200
RewriteRule .* - [L]
&nbsp;
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD) [OR]
#RewriteCond %{QUERY_STRING} !^$ [OR]
RewriteCond %{HTTP_COOKIE} ^.*(comment_author_|wordpress|wp-postpass_).*$ [NC]
RewriteRule ^(.*)$ - [S=6]
&nbsp;
RewriteCond %{HTTP_USER_AGENT} .*W3C_Validator.* [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.xhtml.gz -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.xhtml.gz [L,S=5]
&nbsp;
RewriteCond %{HTTP:Accept} application/xhtml\+xml [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.xhtml.gz -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.xhtml.gz [L,S=4]
&nbsp;
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.html.gz -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.html.gz [L,S=3]
&nbsp;
RewriteCond %{HTTP_USER_AGENT} .*W3C_Validator.* [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.xhtml -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.xhtml [L,S=2]
&nbsp;
RewriteCond %{HTTP:Accept} application/xhtml\+xml [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.xhtml -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.xhtml [L,S=1]
&nbsp;
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/aa/$1/index.html -f
RewriteRule ^(.*)$ /wp-content/cache/aa/$1/index.html [L]
&nbsp;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)\.rdf\ HTTP/ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/rdf/%1.html/index.rdf -f
RewriteRule ^(.*)$ /wp-content/rdf/%1.html/index.rdf [L,S=1]
&nbsp;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(error|w3c|openid)(/?.*)\ HTTP/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /X/%1%2 [L]
&nbsp;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(y_key_bf61afd498f7623a\.html|google3bb7b7e1032ad0d4\.html|yadis\.xrdf|askapache-home\.rdf|os-description\.xml|labels\.rdf|gnu-fdl\.txt|wlmmanifest\.xml|robots\.txt)\ HTTP/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /X/%1 [L]
&nbsp;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /X(.*)\ HTTP/ [NC]
RewriteRule .* - [F]
&nbsp;
RewriteRule ^osq?(.*)$ /wp-content/plugins/wp-opensearch.php?$1 [QSA,L]
&nbsp;
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /wp-login(.+)\ HTTP/ [NC]
#RewriteRule .+ https://www.askapache.com/wp-login%1 [R,L]
&nbsp;
RewriteCond %{REQUEST_URI} ^/cgi-bin/(hash|java)\.cgi$ [NC]
RewriteCond %{HTTP:P3P} ^(([^:]+):(.+))$ [NC]
RewriteRule .* - [E=HTTP_JS:%{HTTP:P3P},E=HTTP_US:%2,E=HTTP_PA:%3]
&nbsp;
RewriteCond %{HTTP_ACCEPT} application/xrds\+xml
RewriteCond %{HTTP_ACCEPT} !application/xrds\+xml\s*;\s*q\s*=\s*0(\.0{1,3})?\s*(,|$)
RewriteRule ^$ http://www.askapache.com/yadis.xrdf [R,L]
&nbsp;
RewriteCond %{HTTP_USER_AGENT} !^(FeedBurner|FeedValidator|talkr.com).* [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(feed|rdf|rss|rss2|atom)/?.*\ HTTP/ [NC]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(feed|rdf|rss|rss2|atom|wp-atom|wp-feed|wp-rdf|wp-rss|wp-rss2).*\ HTTP/ [NC]
RewriteRule .* http://feeds.askapache.com/apache/htaccess? [R=302,L]
&nbsp;
#RewriteCond %{REMOTE_ADDR} ^$
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.+)\.phps$ /cgi-bin/phps.php?file=$1.php [L,NC]</pre>

<p><a href="http://www.askapache.com/htaccess/real-world-htaccess-files.html"></a><a href="http://www.askapache.com/htaccess/real-world-htaccess-files.html">Actual Htaccess Files from My Server</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/htaccess/real-world-htaccess-files.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>30x Faster Cache and Site Speed with TMPFS</title>
		<link>http://www.askapache.com/optimize/super-speed-secrets.html</link>
		<comments>http://www.askapache.com/optimize/super-speed-secrets.html#comments</comments>
		<pubDate>Thu, 18 Mar 2010 15:43:21 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Optimization]]></category>
		<category><![CDATA[tmpfs]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=3220</guid>
		<description><![CDATA[<p><a href="http://www.askapache.com/optimize/super-speed-secrets.html" id="id0"></a></p>
<p>NOT a typo..  30x is measurable, well-documented, and easily tested.  This is what <strong>open-source</strong> is about.   I haven’t had time to post much the past year, I'm always working!  So I wanted to make up for that by publishing an article on a topic that would blow your mind and be something that you could actually start using and really get some benefit out of it. This is one of those articles that the majority of web hosting companies would love to see in paperback, <strong>so they could burn it.</strong></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/optimize/super-speed-secrets.html"></a><a href="http://www.askapache.com/optimize/super-speed-secrets.html"><cite>AskApache.com</cite></a></p><p><a href="http://www.askapache.com/optimize/super-speed-secrets.html"><img src="http://uploads.askapache.com/2009/09/top.jpg" alt="Top showing swap and memory" title="Top showing swap and memory" width="434" height="52" class="size-full wp-image-3270" /></a></p>
<p>I haven't had time to post much the past year, so I wanted to make up for that by publishing an article on a topic that would blow your mind and be something that you could actually start using and really get some benefit out of it.  This is one of those articles that the majority of web hosting companies would love to see in paperback, <strong>so they could burn it</strong>.  Now ask yourself, if a webhost makes money based on how much memory, bandwidth, and data used by a customer, what would they not want their customers to do?  That's right, they do not want their customers to learn how to minimize and drastically reduce these moneymakers.  They get giddy when you complain about slow-site-speed, or that it takes a long time for your site to load, because they have exactly the right answer- upgrade your memory, bandwidth, and data by purchasing a more expensive plan.</p>


<p class="anote"><strong>WARNING</strong>!!  This article has some seriously advanced stuff in it, pretty far beyond my skill level as well (getting there).  I personally shutdown some of my own servers with various webhosts because of this.. Note I said personally, not intentionally.  Even after spending almost a year (this has been in my drafts folder a long time) using TMPFS on as many machines as I can, I still make mistakes (gotta pay attention!) and lose a tmpfs folder..   Oh and if you go experimenting with this stuff on your web host, you will almost definately, most certainly be on the road to getting your account terminated if you are with one of the cheap hosts.  They hate this stuff because it cuts right into the heart of their profit curves and can seriously disrupt a poorly configured machine.  DO NOT TRY THIS!!  (except and of course on your own development machines).   Of course the whole point of this article is how you can take advantage of this incredible filesystem to get crazy speed improvements..  Those are the follow up articles ;)</p>

<p>For those of you who thought modifying your server httpd.conf and htaccess files is very dangerous, you are right.  But this is not like that, this is dangerous in the sense that if you try to rush through with your super amazing "copy and paste skills" (script kids) you will easily lose entire folders.  That's because TMPFS is stored in RAM/Memory, and upon reboot RAM is cleared.  I personally loathe disclaimers, and if you look around you will see there aren't many even with all my sloppy poorly documented articles...  So be careful if you feel up to going further.</p>

<h2>Introducing tmpfs</h2>
<p>If I had to <strong>explain tmpfs</strong> in one breath, I'd say that tmpfs is like a ramdisk, but different. Like a ramdisk, tmpfs can use your RAM, but it can also use your swap devices for storage. And while a traditional ramdisk is a block device and requires a mkfs command of some kind before you can actually use it, tmpfs is a filesystem, not a block device; you just mount it, and it's there. All in all, this makes tmpfs the niftiest RAM-based filesystem I've had the opportunity to meet.</p>


<h2>Beware of WebHosts</h2>
<p>What is a modern day web hosting company?  What costs do they actually have?  A webhost's only unique ability is their connection to the Internet.  That is why you can see such tremendous link speed.  Other than that they consist of servers that are getting smaller and cheaper for them every month.  The servers they use are generally just like any computer, except much larger and built specifically for multi-tasking.</p>
<blockquote cite="http://content.dell.com/us/en/enterprise/virtualization-what-is-it.aspx">
<p>Virtualization allows you to run multiple applications and operating systems independently on a single server. Additionally, administrators can quickly move workloads from one virtual workspace to another — easily prioritizing business needs while maximizing server resources....</p>
<p>Virtualization removes the limitations of the traditional IT approach, enabling <strong>a single PowerEdge server</strong> to operate <strong>multiple applications simultaneously in "virtual machines"</strong></p>
</blockquote>



<h2>Hosting Company Tricks</h2>
<p>Web hosts like to vaguely describe their products as if you are buying your own powerful machine, but in reality you get placed on the same machine as hundreds or thousands of other customers, and the server basically creates an operating system for each customer using virtualization technology.  Everyone on the machine literally is sharing the same RAM and resources, many times even sharing IP address's, and the virtualization software lets them limit the amount of memory / cpu / disk / and bandwidth for each of these virtual machines.  That is why so often when a web host has an outage they make big public announcements and it appears that hundreds or thousands of their customers have been affected.. One of their server farm machines goes offline and it literally takes down all the customers virtualized machines with it.</p>

<h3>Why it gets Evil</h3>
<p>Don't get me wrong, I absolutely love this technology, both the hardware virtualization and the software side, but what I truly do not appreciate is how these companies take advantage of their customers every day and know it.  Here's what they do, they make justifications about why one plan costs more than another, and these justifications are always about the same thing:  CPU's, how fast the data can crunch..  RAM/Memory: How fast and how much your server can handle in terms of traffic... Disk Usage:  How much storage you have... And finally bandwidth: How fast can people get data off your sites, and how many people can connect.</p>
<p>Now lets think for a second.  The webhost has a BIG computer/server/machine that has MASSIVE amounts of RAM, DISK, PROCESSING power, and NETWORK bandwidth.. but just like anything they all have limits.   So if this machine has 10GB of RAM, and the webhost offered plans that have 1GB of RAM, then on that machine they can only have 10 customers right?  WRONG.  If each customer pays $100/month, then of course they would love to have as many customers on that machine as possible.  This builtin incentive is just the reality and isn't anyone fault.</p>

<h3>Where it gets Evil</h3>
<p>Here's what goes on.. all the host advertises is the 1GB of guaranteed RAM with your machine, but for even if the web server was fairly busy it would never use all of that ram because all the software is careful not to use too much, or has no need for any RAM.  Runtime libraries and internal caches use ram, but it's not directly accessed by the customer, only the software.   What happens is when those 10 customers aren't using 100% of their ram, which never happens, then the virtualization technology can use that RAM elsewhere.  So technically you do have 1GB of RAM available, but if you aren't using it then it is essentially FREE RAM that they can sell to another customer.  The only way this wouldn't work of course is if all 11 customers somehow used 100% of RAM simultaneously, at that point the 11th customer would be ramless.  But that is impossible because the system is a load-balancing system that provides both an upper and a lower limit to how much RAM is allotted to each virtual machine.</p>
<p>It sounds unrealistic but I see server farms all the time that are stuffed full of virtual machines, like situations where there are 100 1GB customers all sharing 10GB of RAM..  no-one uses the whole 1GB allotted to them as the maximum amount they can use, and they don't know because it appears they have a lot of free RAM, but really that is virtual RAM and could be used by anyone else on the machine.</p>

<h3>Where it gets Fun (for me)</h3>
<p><a class="IFL" href="http://www.askapache.com/linux/bash-power-prompt.html"><img src="http://uploads.askapache.com/2010/03/askapache-htop.jpg" alt="The HTOP command in full color to manage mysql" title="The HTOP command in full color to manage mysql" width="404" height="176" class="size-full wp-image-4149" /></a>This is actually even worse for anyone who is using what they call "shared-hosting" which is the budget hosting that is the most common.  With shared-hosting there is actually some skill involved on the hosting companies part, like real linux skills.  In this setup they may or more often may not use any virtualization software.  It's just a vanilla multi-user server machine where each customer gets a restricted unix account that powers their website using the same system as thousands of others on the box.  This is usually dirt cheap because it costs so little to do, but alot of companies charge outrageous amounts for shared-hosting because they make it look really full-featured, which it can be, they just don't mention 1000 other people use the same machine, hard-drive, /tmp directory, network device, IP address, etc..  Alot of the times the cheaper end of the spectrum is where the most gifted system administrators are located, they are so good with linux administration that they could fit 10 customers and 100 websites on an XBOX converted to run linux, and you'd think you got a great deal until you found out! lol.  Anyone alive is able to buy more hardware to expand their capacity to take on more customers,  but it takes a lot of knowhow and real skill to have that many users on 1 machine.  I've seen pretty extreme cases that are analogous to the XBOX example (which is possible by the way).<br class="C" /></p>
<p>I personally love shared-hosting environments, because for those of us who know almost as much or more than the system administrators running the machine we are able to use a disproportionate (legally) amount of the CPU and RAM available on the system.  So for example my sites would  all show up fast and be able to handle more traffic than several other customers combined.  Not because
anything has been circumvented, but because I am able to access and utilize as much of the guaranteed 1GB of RAM that I am paying for every month, which is usually just a few bucks.  The downside is that when you have corporate sites or really high-traffic sites then you are forced to move to a more powerful machine..  </p>
<p>This leads to a familiar situation for some of you..  When your site starts becoming popular and you are getting a lot of traffic, this means that your site could be using 10x the amount of RAM and Bandwidth of any other customer in that server farm.  And what that really means to the webhost is that you are costing them 10x what anyone else is..  And if they removed you, they would have the space for 10 new customers to take your place, and they would make 10x more money.  DreamHost is notorious for terminating accounts because of that..  It happened to me except I was given the option to pay 5x more a month for their "upgrade" to a VPS.  Giant shared-hosts advertise like crazy how they offer unlimited bandwidth, but <strong>when you start using 100x more bandwidth than anyone on your server you are costing them 100x what you are paying them, every month</strong>.  That's why you will never see a webhost offering this kind of unlimited bandwidth that doesn't require you to sign a contract giving them permission to terminate your account <em>for any reason</em>.  Seriously read the fine print at DreamHost or anywhere else, it's included because that is a core part of their business to terminate anyone using too much bandwidth since that is bandwidth they can't sell to dozens of other customers.  That's why I eventually closed my account with them and moved to a legitimate company, it's a great host for spammers though.</p>

<p>Back in the mid-90's I was doing a lot of war-dialing with my modem and discovering all sorts of networks and machines, many of them were Unix and Solaris based public systems, and when I managed to gain access to the system and found myself staring at a unix shell I was very excited but also a total idiot.  In those days of using the phone networks to research unknown systems it was very difficult for anyone to actually get the phone company to trace a call, so instead of what happens today where it is child's play to trace an IP address, back then it was a very real back-and-forth battle between the system admin and whoever was gaining access to their system.  Essentially, I would gain a shell or some kind of terminal, and just go at it trying to figure out what it could do, trying all kinds of commands.  Inevitably this would eventually alert even the laziest admin and they would proceed to attempt to lock me out. It was great sport and extremely addictive.  When my favorite system (a massive sun machine in the basement of a big library) finally locked me out and I couldn't get back in I went to my local library and got some reading material -- one of my favorites was the red hat bible.  I was able to acquire my own computer and the first thing I did was install red hat linux onto it from the discs included with the book.  For the next several years I was essentially offline, all we had at home was a modem and it was becoming difficult to locate any more systems in my area code.. I was into phreaking of course as well, but I never was able to make free long-distance war-dialing a reality.  So I just read the books and learned what I could.  I would also goto the library when I could in order to use their machines which were connected to the internet (before aol it was much different than today's internet) and since my time was short I would download as many documents as I could so that I could read them offline.  The TLDP documentation that we know today was around back then in various forms, and I read every HOWTO in the index, though not understanding half.  The other big resource I found for really intense reading was the <a href="http://www.kernel.org/doc/Documentation/">kernel documentation</a>, which admitedly I still don't comprehend 1/4th of..   I try and peruse all the new documents when a new kernel is released, since the kernel is where all the real action is, hence the military authoritative name, and that is how I discovered one of the coolest features of Linux that I have found.  TMPFS!</p>



<h2>TMPFS kills the RAMDISK</h2>
<p>Ok so we all know what RAM is, it's the memory cards that most people never see that is used by the computer to store and access data that all programs need.  RAM is very expensive compared to most PC components, because it's what makes a computer blazing fast or slow.  So real quick lets look at a few (there are not many) ways that various linux hackers use RAM in non-conventional ways in the past.</p>
<p>Tmpfs is a file system which keeps all files in virtual memory.  Everything is temporary in the sense that no files will be created on your hard drive. If you reboot, everything in tmpfs will be lost.</p>
<p>In contrast to RAM disks, which get allocated a fixed amount of physical RAM, tmpfs grows and shrinks to accommodate the files it contains and is able to swap unneeded pages out to swap space.</p>
<p>Like a ramdisk, tmpfs can use your RAM, but it can also use your swap devices for storage. And while a traditional ramdisk is a block device and requires a mkfs command of some kind before you can actually use it, tmpfs is a filesystem, not a block device; you just mount it, and it's there. All in all, this makes tmpfs the niftiest RAM-based filesystem I've had the opportunity to meet.</p>
<p>If I had to <strong>explain tmpfs</strong> in one breath, I'd say that tmpfs is like a ramdisk, but different. Like a ramdisk, tmpfs can use your RAM, but it can also use your swap devices for storage. And while a traditional ramdisk is a block device and requires a mkfs command of some kind before you can actually use it, tmpfs is a filesystem, not a block device; you just mount it, and it's there. All in all, this makes tmpfs the niftiest RAM-based filesystem I've had the opportunity to meet.</p>
<br class="C" />




<p>What kind of filesystem is used on your server to store all your site files?  EXT4, REISERFS, EXT3, NFS, etc.. are the usual filesystems, Windows users are limited to the NTFS filesystem.   A filesystem is different than a device, a device is a hard-drive disk.  A filesystem is how the device is formatted to allow for file and folder structures.  A hard drive is slow compared to RAM, no question about that.  So what if instead of your server serving files off a hard-drive it served files stored in RAM?  <strong>30x faster thats what happens!</strong></p>
<p class="wnote">I just figured out how to store my cached static files created by WP-Super Cache in my server's RAM, and the difference is unbelievable.  My "AskApache Crazy Cache" plugin basically forces WP-Super Cache, Hyper Cache, etc.. to recreate a static cached file for every page on a blog.  For the AskApache.com site this takes around 3 minutes to complete.  Once I switched to using this new method of storing the files on RAM I am able to re-cache the entire site in about 15 seconds!!!!</p>


<p class="wnote">tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files</p>


<blockquote cite="">
<p>Tmpfs is a file system which keeps all files in virtual memory.</p>
<p>Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost.</p>
<p>tmpfs puts everything into the kernel internal caches and grows and shrinks to accommodate the files it contains and is able to swap unneeded pages out to swap space. It has maximum size limits which can be adjusted on the fly via 'mount -o remount ...'</p>
<p>If you compare it to ramfs (which was the template to create tmpfs) you gain swapping and limit checking. Another similar thing is the RAM disk (/dev/ram*), which simulates a fixed size hard disk in physical RAM, where you have to create an ordinary filesystem on top. Ramdisks cannot swap and you do not have the possibility to resize them.</p>
<p>Since tmpfs lives completely in the page cache and on swap, all tmpfs pages currently in memory will show up as cached. It will not show up as shared or something like that. Further on you can check the actual RAM+swap use of a tmpfs instance with df(1) and du(1).</p>
</blockquote>

<p>Both tmpfs and ramfs mount will give you the power of fast reading and writing files from and to the primary memory. When you test this on a small file, you may not see a huge difference. You’ll notice the difference only when you write large amount of data to a file with some other processing overhead such as network.</p>




<h2>TMPFS uses RAM+SWAP</h2>
<p>TMPFS is another filesystem with uniquely cool capabilities.  It stores any files contained within it on RAM and in SWAP which means your server can access any files stored on TMPFS without even having to access the disk, which according to technical stats is around 30 times faster than accessing a file off disk.</p>
<p>Some other cool aspects of TMPFS are that it intelligently and automatically sizes itself to be just alittle bigger then it needs to be.  So when you remove files to a folder stored on a TMPFS filesystem, the TMPFS filesystem shrinks by allocating less RAM and/or SWAP.  Conversely when adding files to TMPFS it grows larger.  You can set the max-size and max-number-of-files as a mount option to make sure your TMPFS never uses all of the available RAM and SWAP, which would halt your server.</p>

<h3>Swap</h3>
<p>Find the swap size.</p>
<pre>
# free -m -t
             total       used       free     shared    buffers     cached
Mem:           458         93        364          0          0          0
-/+ buffers/cache:         93        364
Swap:          900          0        900
Total:        1358         93       1264
</pre>

<pre>
Adding 3004144k swap on /dev/sdb2.  Priority:-1 extents:1 across:3004144k
Adding 2096472k swap on /dev/sda3.  Priority:-2 extents:1 across:2096472k
</pre>

<h2>Using TMPFS for Cache</h2>
<p>The method here will show how to create and use a TMPFS filesystem to hold all the static files created by WP-Super Cache.  These static files are served to visitors instead of loading php for every request, so by moving those static files to TMPFS your server will be able to access and start sending your site to the browser 30x faster!</p>
<p>The WP-Super Cache plugin stores all the static files in the wp-content/cache folder of your WordPress installation, so to enable TMPFS we simply will create a new TMPFS filesystem and mount it to the wp-content/cache folder.  That makes anything in that folder (all the static files) be part of the TMPFS filesystem.</p>


<h2>Boosting Cache with TMPFS</h2>
<p>There are a lot of maybe new concepts surrounding TMPFS and it may seem too complicated, but the process of actually setting up a robust tmpfs to use for wp-super-cache's cache folder is actually very simple.  As long as you have shell access to your server and the permissions required (any sudo or private server should be good to go) you can set this up in a couple minutes and not really have to give it a second thought or debug anything.  Here's the process I've used on several client sites.</p>
<ol>
<li>Create a TMPFS Filesystem and Mount at /wp-content/cache/</li>
<li>Restore TMPFS Cached Files across Reboots</li>
<li>Keep a semi-current mirror of the TMPFS files on Disk</li>
</ol>
<br class="C" />

<h3>Create TMPFS at wp-content/cache</h3>
<p>/etc/fstab</p>
<pre>tmpfs /home/askapache/wp-content/cache tmpfs defaults,size=2g,noexec,nosuid,uid=648,gid=648,mode=1755 0 0</pre>


<h3>Restoring TMPFS across Reboots</h3>
<p>In /etc/rc.local</p>
<pre>
ionice -c3 -n7 nice -n 19 rsync -ahv --stats --delete /_b/tmpfs/cache/ /home/askapache/wp-content/cache/ 1&gt;/dev/null
</pre>

<h3>Mirroring TMPFS to Disk</h3>
<p>Cronjob entry</p>
<pre>
*/5 * * * * /usr/bin/ionice -c3 -n7 /bin/nice -n 19 /usr/bin/rsync -ah --stats --delete /home/askapache/wp-content/cache/ /_b/tmpfs/cache/ 1&gt;/dev/null
</pre>






<span id="more-3220"></span>
<h2>/tmp, /var/run, and /var/lock</h2>
<p>The directories /tmp, /var/run, and /var/lock contain files that are not needed across reboots.  This means they are ideal candidates for tmpfs.  HEre's how to do it.</p>
<pre>tmpfs /var/run tmpfs defaults,rw,nosuid,mode=0755 0 0</pre>
<pre>tmpfs /var/lock tmpfs defaults,rw,noexec,nosuid,nodev,mode=1777 0 0</pre>

<h2>Resize /dev/shm</h2>
<p>You can view your current /dev/shm size with the command <code>df -ha|grep /dev/shm</code> then if you want to resize that use the command:</p>
<pre>mount -t tmpfs -o remount,size-2G,rw,nosuid,nodev tmpfs /dev/shm</pre>

<pre>
Secure /dev/shm:
&nbsp;
Step 1: Edit your /etc/fstab:
&nbsp;
nano -w /etc/fstab
&nbsp;
Locate:
&nbsp;
none /dev/shm tmpfs defaults,rw 0 0
&nbsp;
Change it to:
&nbsp;
none /dev/shm tmpfs defaults,nosuid,noexec,rw 0 0
&nbsp;
Step 2: Remount /dev/shm:
&nbsp;
mount -o remount /dev/shm
&nbsp;
guilt makes extensive use of the &#039;$$&#039; shell variable for temporary
files in /tmp. This is a serious security vulnerability; on multi-user
systems it allows an attacker to clobber files with something like the
following:
&nbsp;
for i in `seq 1 32768`; do
ln -sf /etc/passwd /tmp/guilt.log.$i;
done
&nbsp;
(In this example, if root does e.g. &#039;guilt push&#039;, /etc/passwd will get
clobbered.)
</pre>
<br class="C" />


<h3>Securing and Using /tmp</h3>
<ul>
<li><a href="http://www.sysadmin.md/secure-temporary-folders-on-existing-unix-or-linux-systems.html">Secure temporary folders on existing Unix or Linux systems</a></li>
<li><a href="https://wiki.torproject.org/noreply/TheOnionRouter/OperationalSecurity">Encrypt Storage and Swap Space</a></li>
</ul>










<p><a id="tmpfs-mount"></a></p>
<h2>tmpfs mount parameters</h2>
<p>A good way to find a good tmpfs upper-bound is to use top to monitor your system's swap usage during peak usage periods. Then, make sure that you specify a tmpfs upper-bound that's slightly less than the sum of all free swap and free RAM during these peak usage times. </p>
<p><strong>mode=1777</strong> sets sticky bit on directory. Only file owners can delete files in this directory.</p>
<p>The following parameters accept a suffix k, m or g for Ki, Mi, Gi (binary kilo, mega and giga) and can be changed on remount.</p>
<ul>
<li><strong>size</strong>:  Override default maximum size of the filesystem.  The size is given in bytes, and rounded down to entire pages.  The default is half of the memory.The limit of allocated bytes for this tmpfs instance. The default is half of your physical RAM without swap. If you oversize your tmpfs instances the machine will deadlock since the OOM handler will not be able to free that memory.</li>
<li><strong>nr_inodes</strong>:  Set number of inodes.</li>
<li><strong>nr_blocks</strong>:  Set number of blocks.</li>
<li><strong>mode</strong>: The permissions as an octal number</li>
<li><strong>uid</strong>: The user id</li>
<li><strong>gid</strong>: The group id</li>
</ul>
<pre>mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs</pre>
<p>Will give you tmpfs instance on /mytmpfs which can allocate 10GB RAM/SWAP in 10240 inodes and it is only accessible by root.</p>









<p><a id="tmp-tmpfs"></a></p>
<h2>Using tmpfs for /tmp storage</h2>
<p>Many users find it very convenient to use tmpfs for /tmp and /var/tmp which does a number of positive things.  Any temporary files are instead created in RAM not your hard-drive, which means that reading/writing/accessing those temporary files by various processes doesn't slow down your hard-drive read/writes/accesses for your other processes.  This also has a side-effect of making your hard-drive have a longer life as it reduces activity by a huge amount.</p>
<p>Remember that tmpfs uses both RAM and swap, so make sure your machine has a large swapfile, like gigabytes.  If your tmpfs consumes all the swap and RAM then you are screwed, so make sure that you correctly set the mount options for the tmpfs so that it doesn't do that.  If your /tmp or /var/tmp gets filled with tmp files that for some reason don't get deleted except at reboot, and your machine has a very high uptime, then you will want to run some cron jobs to periodically clean the /tmp and /var/tmp directories of older files...</p>

<p>Here's an example scenario: let's say that we have an existing filesystem mounted at /tmp. However, we decide that we'd like to start using tmpfs for /tmp storage.</p>
<p>with recent 2.4 kernels, you can mount your new /tmp filesystem without getting the "device is busy" error: </p>
<pre>mount tmpfs /tmp -t tmpfs -o size=64m</pre>
<p>With a single command, your new tmpfs /tmp filesystem is mounted at /tmp, on top of the already-mounted partition, which can no longer be directly accessed. However, while you can't get to the original /tmp, any processes that still have open files on this original filesystem can continue to access them. And, if you umount your tmpfs-based /tmp, your original mounted /tmp filesystem will reappear. In fact, you can mount any number of filesystems to the same mountpoint, and the mountpoint will act like a stack; unmount the current filesystem, and the last-most-recently mounted filesystem will reappear from underneath.</p>







<p><a id="bind-mounts"></a></p>
<h2>Bind Mounts</h2>
<p>Using bind mounts, we can mount all, or even part of an already-mounted filesystem to another location, and have the filesystem accessible from both mountpoints at the same time!</p>
<p>For example, you can use bind mounts to mount your existing /tmp filesystem to /sites/askapache.com/tmp, as follows:</p>
<pre>mount --bind /tmp /sites/askapache.com/tmp</pre>
<p>Now, if you look inside /sites/askapache.com/tmp, you'll see your /tmp filesystem and all its files. And if you modify a file on your /tmp filesystem, you'll see the modifications in /sites/askapache.com/tmp as well. This is because <strong>they are one and the same filesystem; the kernel is simply mapping the filesystem to two different mountpoints for us</strong>. </p>
<p>Note that when you mount a filesystem somewhere else, any filesystems that were mounted to mountpoints inside the bind-mounted filesystem will not be moved along. In other words, if you have /tmp/cache on a separate filesystem, the bind mount we performed above will leave /sites/askapache.com/tmp/cache empty. You'll need an additional bind mount command to allow you to browse the contents of /tmp/cache at /sites/askapache.com/tmp/cache:</p>
<pre>mount --bind /tmp/cache /sites/askapache.com/tmp/cache</pre>

<h3>Bind mounting and /dev/shm</h3>
<p>glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for POSIX shared memory (shm_open, shm_unlink). Adding the following line to /etc/fstab should take care of this:</p>
<pre>tmpfs  /dev/shm  tmpfs  defaults  0 0</pre>

<p>Many systems by default have a tmpfs filesystem mounted at /dev/shm that defaults to a size of half of your physical RAM without swap.  Say you decide that you'd like to start using tmpfs for /tmp, which currently lives on your root filesystem. Rather than mounting a new tmpfs filesystem to /tmp (which is possible), you may decide that you'd like the new /tmp to share the currently mounted /dev/shm filesystem. However, while you could bind mount /dev/shm to /tmp and be done with it, your /dev/shm contains some directories that you don't want to appear in /tmp. So, what do you do? How about this:</p>



<pre>
mkdir /dev/shm/tmp
chmod 1777 /dev/shm/tmp
mount --bind /dev/shm/tmp /tmp
</pre>

<p>In this example, we first create a /dev/shm/tmp directory and then give it 1777 perms, the proper permissions for /tmp. Now that our directory is ready, we can mount /dev/shm/tmp, and only /dev/shm/tmp to /tmp. So, while /tmp/foo would map to /dev/shm/tmp/foo, there's no way for you to access the /dev/shm/bar file from /tmp.</p>
<br class="C" />









<p><a id="default-tmpfs-workaround"></a></p>
<h2>/etc/default/tmpfs WorkAround</h2>
<pre>
$ cat /etc/default/tmpfs
# SHM_SIZE sets the maximum size (in bytes) that the /dev/shm tmpfs can use.
# If this is not set then the size defaults to the value of TMPFS_SIZE
# if that is set; otherwise to the kernel&#039;s default.
#
# The size will be rounded down to a multiple of the page size, 4096 bytes.
SHM_SIZE=524288000
# TMPFS_SIZE sets the max size that /dev/shm can use.  By default, the
# kernel sets this upper limit to half of available memory.
TMPFS_SIZE=524288000
</pre>




<p><a id="rsync-vs-cp"></a></p>
<h2>RSYNC vs. CP</h2>
<pre>
rsync [options]  SRC DEST
rsync -av --delete --stats /home/wincom/public_html/wp-content/cache/ /backups/tmp-mnt/cache/
-a, --archive               archive mode; same as -rlptgoD (no -H)
-r, --recursive             recurse into directories
-l, --links                 copy symlinks as symlinks
-p, --perms                 preserve permissions
-t, --times                 preserve times
-g, --group                 preserve group
-o, --owner                 preserve owner (super-user only)
-D                          same as --devices --specials
    --devices               preserve device files (super-user only)
    --specials              preserve special files
 -h, --human-readable        output numbers in a human-readable format
     --progress              show progress during transfer
</pre>




<p><a id="mount-options"></a></p>
<h2>Mount Options</h2>
<p>The following options apply to any file system that is being mounted (but not every file  system  actually honors them)</p>
<ul>
<li><code>async</code> All I/O to the file system should be done asynchronously.</li>
<li><code>atime</code> Update inode access time for each access. This is the default.</li>
<li><code>auto</code> Can be mounted with the -a option.</li>
<li><code>defaults</code> Use default options: rw, suid, dev, exec, auto, nouser, and async.</li>
<li><code>dev</code> Interpret character or block special devices on the file system.</li>
<li><code>exec</code> Permit execution of binaries.</li>
<li><code>group</code> Allow an ordinary (i.e., non-root) user to mount the file system if one of his groups matches the group of the device.  This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line group,dev,suid).</li>
<li><code>mand</code> Allow mandatory locks on this filesystem. See fcntl(2).</li>
<li><code>_netdev</code> The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).</li>
<li><code>noatime</code> Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers).</li>
<li><code>nodiratime</code> Do not update directory inode access times on this filesystem.</li>
<li><code>noauto</code> Can only be mounted explicitly (i.e., the -a option will not cause the file system to be mounted).</li>
<li><code>nodev</code> Do not interpret character or block special devices on the file system.</li>
<li><code>noexec</code> Do not allow direct execution of any binaries on the mounted file system.  (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)</li>
<li><code>nomand</code> Do not allow mandatory locks on this filesystem.</li>
<li><code>nosuid</code> Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl(1) installed.)</li>
<li><code>nouser</code> Forbid an ordinary (i.e., non-root) user to mount the file system.  This is the default.</li>
<li><code>owner</code> Allow an ordinary (i.e., non-root) user to mount the file system if he is the owner of the device.  This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line owner,dev,suid).</li>
<li><code>remount</code> Attempt to remount an already-mounted file system.  This is commonly used to change the mount flags for a file system, especially to make a readonly file system writeable. It does not change device or mount point.</li>
<li><code>ro</code> Mount the file system read-only.</li>
<li><code>_rnetdev</code> Like _netdev, except "fsck -a" checks this filesystem during rc.sysinit.</li>
<li><code>rw</code> Mount the file system read-write.</li>
<li><code>suid</code> Allow set-user-identifier or set-group-identifier bits to take effect.</li>
<li><code>sync</code> All I/O to the file system should be done synchronously. In case of media with limited number of write cycles (e.g. some flash drives) "sync" may cause life-cycle shortening.</li>
<li><code>dirsync</code> All directory updates within the file system should be done synchronously.  This affects the following system calls: creat, link, unlink, symlink, mkdir, rmdir, mknod and rename.</li>
<li><code>user</code> Allow  an ordinary user to mount the file system.  The name of the mounting user is written to mtab so that he can unmount the file system again.  This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).</li>
<li><code>users</code> Allow every user to mount and unmount the file system.  This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).</li>
</ul>



<p><a id="filesystems"></a></p>
<h2>Filesystems</h2>
<p>You can find out what is filesystems are in place by using one of the following linux commands:</p>
<pre>
cat /etc/fstab
cat /etc/mtab
cat /proc/mounts
df -a
</pre>
<h2>/etc/fstab</h2>
<pre>
       /etc/fstab        file system table
       /etc/mtab         table of mounted file systems
       /etc/mtab~        lock file
       /etc/mtab.tmp     temporary file
       /etc/filesystems  a list of filesystem types to try
</pre>

<p>From /etc/mtab</p>
<pre>none /tmp tmpfs size=128m,mode=1777 0 0</pre>

<p>From /proc/mounts</p>
<pre>none /tmp tmpfs rw,nodev,relatime,size=131072k 0 0</pre>






<br class="C" />
<p><a id="fstab"></a></p>
<h2>/etc/fstab</h2>
<p>It is possible that files /etc/mtab and /proc/mounts don’t match. The first file is based only on the mount command options, but the content of the second file also depends on the kernel and others settings (e.g.  remote NFS server. In particular case  the  mount  command  may reports unreliable information about a NFS mount point and the /proc/mounts file usually contains more reliable information.)</p>
<p>This file is used in three ways:</p>
<ol>
<li>The following command (usually given in a bootscript) causes all file systems mentioned in fstab (of the proper type and/or having or not having the proper options) to be mounted as indicated, except for those whose line contains the noauto keyword. Adding the -F option will  make  mount  fork,  so that the filesystems are mounted simultaneously.<pre>mount -a [-t type] [-O optlist]</pre></li>
<li>When mounting a file system mentioned in fstab, it suffices to give only the device, or only the mount point.</li>
<li>Normally, only the superuser can mount file systems.  However, when fstab contains the user option on a line, anybody can mount the corresponding system.</li>
</ol>
<p>The programs mount and umount maintain a list of currently mounted file systems in the file /etc/mtab.</p>
<p>Only the user that mounted a filesystem can unmount it again.  If any user should be able to unmount, then use users instead of user in the fstab line.  The owner option is similar to the user option, with the restriction that the user must be the owner of the special file.  The group option is similar, with the restriction that the user must be member of the group of the special file.</p>
<p>The order of records in fstab is important because fsck(8), mount(8), and umount(8) sequentially iterate through fstab doing their thing.</p>
<h3>The first field, (fs_spec)</h3>
<p>Describes the block special device or remote filesystem to be mounted.  For ordinary mounts it will hold (a link to) a block special device node (as created by mknod(8)) for the device to be mounted, like ‘/dev/cdrom’ or ‘/dev/sdb7’.  For NFS mounts one will have <code>&lt;host&gt;:&lt;dir&gt;</code>, e.g., ‘knuth.aeb.nl:/’.  For procfs, use ‘proc’.</p>
<p>Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf.  e2label(8) or xfs_admin(8)), writing LABEL=<label> or UUID=<uuid>, e.g., ‘LABEL=Boot’ or  ‘UUID=3e6be9de-8139-11d1-9106-a43f08d823a6’.  This will make the system more robust: adding or removing a SCSI disk changes the disk device name but not the filesystem volume label.</p>
<h3>The second field, (fs_file)</h3>
<p>Describes the mount point for the filesystem.  For swap partitions, this field should be specified as ‘none’. If the name of the mount point contains spaces these can be escaped as ‘\040’.</p>
<p>The  third  field,  (fs_vfstype),  describes the type of the filesystem.  Linux supports lots of filesystem types, such as adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details, see mount(8).  <strong>For the filesystems currently supported by the running kernel, see /proc/filesystems</strong>.  An entry swap denotes  a  file  or  partition  to  be  used  for  swapping,  cf.  swapon(8).  An entry ignore causes the line to be ignored.  This is useful to show disk partitions which are currently unused.</p>
<h3>The fourth field, (fs_mntops)</h3>
<p>Describes the mount options associated with the filesystem.  It  is formatted as a comma separated list of options.  It contains at least the type of mount plus any additional options appropriate to the filesystem type.  For documentation on the available options for non-nfs file systems, see mount(8).  For documentation on all nfs-specific options have a look at nfs(5).</p>
<p>Common for all types of file system are the options:</p>

<ul>
<li><strong>noauto</strong>: (do not mount when "mount -a" is given, e.g., at boot time)</li>
<li><strong>user</strong>: (allow a user to mount)</li>
<li><strong>owner</strong>: (allow device owner to mount)</li>
<li><strong>pamconsole</strong>: (allow a user at the console to mount)</li>
<li><strong>comment</strong>: (e.g., for use by fstab-maintaining programs).</li>
</ul>
<h3>The fifth field, (fs_freq)</h3>
<p>Used for these filesystems by the dump(8) command to determine which filesystems need to be dumped.  If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.</p>
<h3>The  sixth  field,  (fs_passno)</h3>
<p>Used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time.  The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2.  Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware.  If the sixth field is not present or zero, a value of zero is returned and <strong>fsck will assume that the filesystem does not need to be checked</strong>.








<h3>More Reading</h3>
<ul>
<li><a href="http://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux/">Overview of RAMFS and TMPFS on Linux</a></li>
<li><a href='http://uploads.askapache.com/2009/09/ramfs-rootfs-initramfs.txt'>ramfs, rootfs and initramfs</a></li>
<li><a href='http://uploads.askapache.com/2009/09/tmpfs.txt'>Tmpfs is a file system which keeps all files in virtual memory</a></li>
<li><a href="http://www.ibm.com/developerworks/library/l-fs3.html">IBM: Advanced filesystem implementor's guide, Part 3</a></li>
<li><a href="http://en.wikipedia.org/wiki/TMPFS">TMPFS Wikipedia Entry</a></li>
<li><a href="http://en.wikipedia.org/wiki/Shared_memory">Shared Memory</a></li>
<li><a href="http://kevin.vanzonneveld.net/techblog/article/create_turbocharged_storage_using_tmpfs/">Create turbocharged storage using tmpfs</a></li>

<li><a href="http://dev.mysql.com/doc/refman/4.1/en/temporary-files.html">Where MySQL Stores Temporary Files</a></li>
<li><a href="http://www.linuxized.com/2009/05/speeding-up-firefox-with-tmpfs-and-automatic-rsync/">speeding up firefox with tmpfs and automatic rsync</a> <a href="http://www.linuxized.com/wp-content/uploads/2009/05/speedfox">(shell-script)</a> <a href="http://autoverse.net/blog/2009/apr/23/speed-firefox/">Original</a></li>
<li><a href="http://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt">kernel documentation for tmpfs</a></li>
<li><a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=386368">initscripts: please don't mount /dev/shm noexec</a></li>
<li><a href="http://forums.debian.net/viewtopic.php?t=16450">HOWTO: Using tmpfs for /tmp, /var/{log,run,lock...}</a></li>
<li><a href="http://forums.gentoo.org/viewtopic-t-371889-highlight-tmpfs.html">Gentoo Forums: Using tmpfs for /var/{log,lock,...}</a></li>
<li><a href="http://forums.gentoo.org/viewtopic-t-717117-highlight-tmpfs.html">[TIP] Firefox and tmpfs: a surprising improvement</a></li>
</ul>

<blockquote cite="http://openquery.com/blog/experiment-mysql-tmpdir-on-tmpfs">
<cite><a href="http://openquery.com/blog/experiment-mysql-tmpdir-on-tmpfs">Experiment: MySQL tmpdir on tmpfs</a></cite>
<p>In MySQL, the tmpdir path is mainly used for disk-based sorts (if the sort_buffer_size is not enough) and disk-based temp tables. The latter cannot always be avoided even if you made tmp_table_size and max_heap_table_size quite large, since MEMORY tables don’t support TEXT/BLOB type columns, and also since you just really don’t want to run the risk of exceeding available memory by setting these things too large.</p></blockquote>
<br class="C" />






<h2>Use tmpfs for MySQL</h2>
<pre>
--tmpdir=path, -t path
</pre>
<blockquote cite="http://dev.mysql.com/doc/refman/4.1/en/server-options.html#option_mysqld_tmpdir">The path of the directory to use for creating temporary files. It might be useful if your default /tmp directory resides on a partition that is too small to hold temporary tables. Starting from MySQL 4.1.0, this option accepts several paths that are used in round-robin fashion. Paths should be separated by colon characters (“:”) on Unix and semicolon characters (“;”) on Windows, NetWare, and OS/2. If the MySQL server is acting as a replication slave, you should not set --tmpdir to point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. For more information about the storage location of temporary files, see Section A.1.4.4, “Where MySQL Stores Temporary Files”. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables or LOAD DATA INFILE operations. If files in the temporary file directory are lost when the server restarts, replication fails. </blockquote>

<blockquote cite="http://dev.mysql.com/doc/refman/4.1/en/temporary-files.html">On Unix, MySQL uses the value of the TMPDIR  environment variable as the path name of the directory in which to store temporary files. If TMPDIR  is not set, MySQL uses the system default, which is usually /tmp, /var/tmp, or /usr/tmp.

 If the file system containing your temporary file directory is too small, you can use the --tmpdir option to mysqld to specify a directory in a file system where you have enough space.

Starting from MySQL 4.1, the --tmpdir option can be set to a list of several paths that are used in round-robin fashion. Paths should be separated by colon characters (“:”) on Unix and semicolon characters (“;”) on Windows, NetWare, and OS/2.
Note

To spread the load effectively, these paths should be located on different physical disks, not different partitions of the same disk.

If the MySQL server is acting as a replication slave, you should not set --tmpdir to point to a directory on a memory-based file system or to a directory that is cleared when the server host restarts. A replication slave needs some of its temporary files to survive a machine restart so that it can replicate temporary tables or LOAD DATA INFILE operations. If files in the temporary file directory are lost when the server restarts, replication fails.

MySQL creates all temporary files as hidden files. This ensures that the temporary files are removed if mysqld is terminated. The disadvantage of using hidden files is that you do not see a big temporary file that fills up the file system in which the temporary file directory is located.
</blockquote>
<br class="C" />








<h2>Shell Script for Firefox tmpfs</h2>
<pre>
#!/bin/bash
### Bind temporary directories to /dev/shm ###
# I do this instead of mounting tmpfs on the #
# directories, so less memory gets wasted.   #
##############################################
mkdir /dev/shm/{tmp,lock}
mount --bind /dev/shm/tmp /tmp
mount --bind /dev/shm/tmp /var/tmp
mount --bind /dev/shm/lock /var/lock
chmod 1777 /dev/shm/{tmp,lock}
</pre>




<hr />

<p><strong>Hey!</strong> You made it!@ at least to the bottom of the page..  I still have to finish this article, so check back in a few months.</p><p><a href="http://www.askapache.com/optimize/super-speed-secrets.html"></a><a href="http://www.askapache.com/optimize/super-speed-secrets.html">30x Faster Cache and Site Speed with TMPFS</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/optimize/super-speed-secrets.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Windows Optimization &#8211; Intense Part II</title>
		<link>http://www.askapache.com/windows/defrag-optimize-speed-xp.html</link>
		<comments>http://www.askapache.com/windows/defrag-optimize-speed-xp.html#comments</comments>
		<pubDate>Mon, 05 Oct 2009 13:42:28 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=3039</guid>
		<description><![CDATA[<p><a href="http://www.askapache.com/windows/defrag-optimize-speed-xp.html" class="IFL" id="id3"></a>If you ever wanted to know the best way to defragment and speed up your Windows-Based PC, I mean you <em>really</em> wanted to know, here is the 2nd part to my article on Windows Speed Optimizing that details the process I have found works really well.  Definately not a quick process, and certainly not the best ever, just my best ever and one that you only have to do once to get the benefits.
This article has a lot of incredibly useful (and FREE) tools I recommend, which you can grab and use without reading the article..<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/windows/defrag-optimize-speed-xp.html"></a><a href="http://www.askapache.com/windows/defrag-optimize-speed-xp.html"><cite>AskApache.com</cite></a></p><p>This is part 2 of my Windows XP Optimization article:  <a href="http://www.askapache.com/windows/blazing-fast-xp-speed.html">Make Windows XP Blazingly Fast</a>.</p>
<p>The first article was meant as a <a href="http://www.askapache.com/windows/blazing-fast-xp-speed.html">detailed and thorough introduction to speeding up Windows-based PC's</a> in a way that makes it easy to follow, without getting too specific.  So make sure you read that first, and pay the most attention to freeing up RAM, CPU, and Disk IO speed by reducing the number of services and processes that are running, we will deal with defragmentation, hard-drive speed, Disk IO, Prefetching, and Pagefile/Registry Defragmentation now.</p>

<p>This article has some really really really great stuff for ya.  It shows which tools (all but one completely free) are the best and you will use them for a long time, they are all very good.  That is just a side benefit, as this article is really more of a step-by-step guide to optimizing your system that won't have to be repeated for at least a year.  The result of course is a much more responsive PC.</p>

<h2>Whats New</h2>
<p>After writing that article I continued my research and testing into the subject on my personal computers.  I wanted to test out several additional programs and methods before I wrote about them for you guys, and I found a few really sweet additions that had a very big performance gain for all my computers, from my oldest and slowest PC's to my new 4K power laptop.  This article is primarily focused on optimizing your hard drive data and improving your Disk IO speed, and you will definately see an improvement in speed.  It doesn't get REALLY good until the defragmenting section..</p>
<ol>
<li><a href="#optimize-hard-drive">Clean Up Hard Drive</a> - Removing unneccessary files</li>
<li><a href="#registry-cleaning">Clean Registry</a> - Fixing slow registry problems automatically</li>
<li><a href="#defragmenting">Ultimate Defragmenting</a> - The best defrag method I use</li>
<li><a href="#optimize-disk">Optimize Physical Hard Disk</a> - Final step that cleans and heals your physical disk</li>
</ol>


<hr class="C" /><p><a id="optimize-hard-drive" name="optimize-hard-drive"></a></p>
<h2>Clean Up Hard Drive</h2>
<p>The first step is to clean up all the extra, temporary, and unneccessary files cluttering your hard-drive.  The reason is because we will be defragmenting your hard-drive like its never been defragged before, then we are going to go over every single bit and byte of your hard-drive to optimize the physical sectors and storage of your data..   Also we will be running a check of your registry and cleaning out bad links and other slow errors, so get it as clutter-free as possible.  DON'T use Windows built-in folder compression, it makes defragmentation worse... DO use 7-zip or winrar to create a solid archive file of any misc directories with a bunch of files... You only need one program to clean your system.</p>

<h3>CCleaner</h3>
<p><a class="ccleaner ccl1 IFL" href="http://uploads.askapache.com/2009/10/screen_301.png" title="CCleaner main program window open on the Windows tab"></a>CCleaner is a Small, Fast and Free software that removes unused and temporary files from your system and allows Windows to run faster, more efficiently and gives you more hard disk space.  I've now been using it for several months and love it.  As well as cleaning up old files and settings left by standard Windows components, CCleaner also cleans temporary files and recent file lists for many applications. Including: Firefox, Opera, Safari, Media Player, eMule, Kazaa, Google Toolbar, Netscape, Microsoft Office, Nero, Adobe Acrobat Reader, WinRAR, WinAce, WinZip and more... Google Chrome, Opera, Safari, etc..<br class="C" /></p>
<ul>
<li>Recycle Bin, Clipboard</li>
<li>Windows Temporary files, Windows Log files, Chkdsk file fragments</li>
<li>Recent Documents (on the Start Menu), Run history (on the Start Menu)</li>
<li>Windows XP Search Assistant history, old Prefetch data, Windows memory dumps after crashes</li>
</ul>
<p><a href="http://www.ccleaner.com/download">Download CCleaner</a><br class="C" /></p>






<hr class="C" /><p><a id="registry-cleaning" name="registry-cleaning"></a></p>
<h2>Registry Cleaning</h2>
<p>The registry is Windows biggest mistake, (although I'm sure they like it), and basically holds all the information for your programs and Windows.  Things like the size of your windows, recent file lists, icon files for different icons, etc..  I've never seen a computer that didn't have some registry issues, so this needs to be cleaned and may have a huge impact on your speed.  Real quickly, here are some programs to backup and restore your registry, optimize and defrag your registry, and finally search and clean any errors in your registry.</p>

<h3>CCleaner</h3>
<p><a class="ccleaner ccl3 IFL" href="http://uploads.askapache.com/2009/10/screen_303.png" title="CCleaner Issue Scanning section with the results of a scan"></a>Yup!  CCleaner also takes care of most of the performance issues of your registry.  It's very safe and fast.  CCleaner uses an advanced Registry Cleaner to check for problems and inconsistencies. It checks the following:<br class="C" /></p>
<ul>
<li>ClassIDs, ProgIDs, Application Paths, Icons</li>
<li>Uninstallers, Shared DLLs, Fonts, Help File references</li>
<li>File Extensions, ActiveX Controls, Invalid Shortcuts and more...</li>
</ul>
<p><a href="http://www.ccleaner.com/download">Download CCleaner</a><br class="C" /></p>


<h3>ERUNT - The Emergency Recovery Utility NT</h3>
<p><img class="IFL" src="http://uploads.askapache.com/2009/10/erunt.gif" alt="ERUNT – Registry Backup and Restore Emergency Recovery Utility for Windows" title="ERUNT – Registry Backup and Restore Emergency Recovery Utility for Windows" width="32" height="32" /><a href="http://www.larshederer.homepage.t-online.de/erunt/index.htm">ERUNT</a> is a Registry Backup and Restore utility for Windows NT/2000/2003/XP.  I use this to backup my registry automatically or on command.. Ive used it for years and it's always good to backup before you do anything.<br class="C" /></p>
<pre># Here&#039;s the command I use (only for advanced users familiar with autoback)
"%ProgramFiles%\ERUNT\AUTOBACK.EXE" %SystemRoot%\ERDNT\#Date# sysreg curuser otherusers /noconfirmdelete /noprogresswindow /days:45 /alwayscreate</pre>
<p><a href="http://www.larshederer.homepage.t-online.de/erunt/">Download ERUNT</a> &middot; (<a href="http://www.larshederer.homepage.t-online.de/erunt/erunt.txt">Details</a>)<br class="C" /></p>


<h3>NTGREGOPT - NT Registry Optimizer</h3>
<p><img class="IFL" src="http://uploads.askapache.com/2009/10/ntregopt.gif" alt="NTGREGOPT – NT Registry Optimizer for Windows" title="NTGREGOPT – NT Registry Optimizer for Windows" width="32" height="32" /><a href="http://www.larshederer.homepage.t-online.de/erunt/index.htm">NTGREGOPT</a> is a Registry Optimization tool for Windows NT/2000/2003/XP/Vista that minimizes the size of your registry files by simply compacting the registry hives to the minimum size possible.<br /><br />Registry files in an NT-based system can become fragmented over time, occupying more space on your hard disk than necessary and decreasing overall performance. You should use the NTREGOPT utility regularly, but especially after installing or uninstalling a program, to minimize the size of the registry files and optimize registry access.  The program works by recreating each registry hive "from scratch", thus removing any slack space that may be left from previously modified or deleted keys.  It does NOT change the contents of the registry in any way, nor does it physically defrag the registry files on the drive.  I recommend using this once every couple weeks.  I scheduled it to run automatically.<br class="C" /></p>
<p><a href="http://www.larshederer.homepage.t-online.de/erunt/">Download NTGREGOPT</a> &middot; (<a href="http://www.larshederer.homepage.t-online.de/erunt/ntregopt.txt">Details</a>)<br class="C" /></p>











<hr class="C" /><p><a id="defragmenting" name="defragmenting"></a></p>
<h2>Ultimate Defragmenting</h2>
<p>I say "Ultimate Defragmenting" because this is the result of a lot of testing of all the various defragmenting software out there, reading a lot of documentation, and running benchmarking to find the fastest results.  This is a mix of several individual defragmenting steps combined for a once-a-year ultimate defragmenting session.  This is what I use today, and although it's altogether a long process, each step you'll add a new tool or skill that you can use by itself from here on out.</p>
<p class="inote">ATTENTION:  While running MyDefrag/JkDefrag, SpinRite, and UltraDefrag your computer can get very hot and that is very not cool.  I set my laptop on a coke can and pointed a small desk fan at it which kept it very very cool, so do what you can to minimize heat during these programs.</p>


<h3>PageDefrag</h3>
<p><img src="http://uploads.askapache.com/2009/10/PageDefrag-115x94.gif" alt="PageDefrag SysInternals By Mark Russinovich" title="PageDefrag SysInternals By Mark Russinovich" width="115" height="94" class="IFL" /><a href="http://technet.microsoft.com/en-us/sysinternals/bb897426.aspx">PageDefrag</a> uses advanced techniques to provide you what commercial defragmenters cannot: the ability for you to see how fragmented your paging files and Registry hives are, and to defragment them. In addition, it defragments event log files and Windows 2000/XP hibernation files (where system memory is saved when you hibernate a laptop).  One of the limitations of the Windows NT/2000 defragmentation interface is that it is not possible to defragment files that are open for exclusive access. Thus, standard defragmentation programs can neither show you how fragmented your paging files or Registry hives are, nor defragment them. Paging and Registry file fragmentation can be one of the leading causes of performance degradation related to file fragmentation in a system.<br class="C" /></p>
<p>I personally keep this enabled for every boot, as it only takes a few seconds after the first time it's run.</p>
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897426.aspx">Download PageDefrag</a><br class="C" /></p>



<h3>MyDefrag</h3>
<p><img class="IFL" src="http://uploads.askapache.com/2009/10/jkdefrag.gif" alt="Windows Optimization   Intense Part II" title="jkdefrag" width="128" height="101" class="alignnone size-full wp-image-3420" />JkDefrag is a disk defragmenter and optimizer for Windows 2000/2003/XP/Vista/2008/X64. Completely automatic and very easy to use, fast, low overhead, with several optimization strategies, and can handle floppies, USB disks, memory sticks, and anything else that looks like a disk to Windows. Included are a Windows version, a commandline version (for scheduling by the task scheduler or for use from administrator scripts), a screensaver version, a DLL library (for use from programming languages), versions for Windows X64, and the complete sources. (<a href="http://www.mydefrag.com/Manual-FrequentlyAskedQuestions.html">Frequently Asked Questions</a>)<br class="C" /></p>
<p>After trying out dozens of degragmenting programs, this is my favorite.  I utilize the cool screensaver function and just run sometimes when I'm calling it a day.</p>

<h4><a href="http://www.mydefrag.com/Manual-TipsAndTricks.html">Tips and tricks</a></h4>
<ul>
  <li>Many users start looking for defragmentation/optimization programs when their computer becomes slow. The main reason for a slow computer is a full harddisk. A full harddisk is slow because the distance between files is greater than on a fresh practically empty harddisk. Deleting half the data on a full disk will just about double the speed. The more free diskspace, the faster your computer will be.</li>
  <li>Buy a second harddisk (for example an USB harddisk) and move little used stuff from your primary harddisk to that secondary harddisk. The second disk can also be used for backing up the primary disk.</li>
  <li>When buying a new computer, buy the biggest harddisk you can afford. Investing in a bigger harddisk gives more speed-per-dollar than investing in a faster CPU or investing in more memory.</li>
  <li>Cleanup old junk from your harddisk before running MyDefrag. You can clean Windows files with for example "Start -&gt; Programs -&gt; Accessories -&gt; System Tools -&gt; Disk Cleanup", or with something like the freeware <a href="http://www.ccleaner.com/"><b>CCleaner</b></a> program.</li>
  <li>Reboot before running MyDefrag. This will release files that are in use, so they can be defragmented and optimized.</li>
  <li>Boot into Windows safe mode by pressing F8 when booting, and then run MyDefrag. It will be slower because the Windows disk cache is off in safe mode, but MyDefrag will be able to process (a few) more files.</li>
  <li>Stop your real time virus scanner before running MyDefrag. Virus scanners check all disk activity, making defragmentation and optimization very slow.</li>
  <li>Move the swap file to another volume, reboot, defragment, and move the swap file back. If you don't have a second volume then temporarily make the swap file small, for example 100Mb.</li>
  <li>Package unused files with a packager such as <a href="http://www.7-zip.org/">7-zip</a>. The packagefile not only takes less harddisk space, but will also defragment and optimize much faster than the individual files. <b>Note</b>: This does not apply to Windows NTFS compression, which will actually make defragmentation and optimization slower.</li>
  <li>The first partition on a harddisk is significantly faster than other partitions. Try to use other partitions only for data that is used less often, such as music, movies, archives, backups, logfiles.</li>
  <li>If you have 2 physical harddisks of the same speed, then place the pagefile on the first partition of the second harddisk.</li>
</ul>
<p>The way I recommend is to run MyDefrag at the highest level of defragmentation once, which took my fastest PC almost 30 hours.  Once that is done you can just run it normally in 20 minutes or so.. This software also has the best defrag information I've found to date, so check out the documentation on the site.</p>
<p><a href="http://www.mydefrag.com/Manual-DownloadAndInstall.html">Download MyDefrag</a><br class="C" /></p>



<h3>UltraDefrag</h3>
<p><img class="IFL" src="http://uploads.askapache.com/2009/10/ultra_defrag.gif" alt="UltraDefrag - powerful Defragmentation tool for Windows" title="UltraDefrag - powerful Defragmentation tool for Windows" width="196" height="158" class="alignnone size-full wp-image-3424" />UltraDefrag is a powerful Open Source Defragmentation tool for Windows Platform. It is very fast, because the defragmenting is done via the kernel-mode driver. There are three interface available : Graphical, Console and Native.  I personally like the MyDefrag more because I think it does a better job, but I also use the UltraDefrag tool because it has one very important feature like the PageDefrag tool.  It has a native version.  That means it can run before Windows loads up by utilizing the bootexecute, the same place that windows chkdsk runs at boot.   It also can takeover for Windows builtin prefetcher, to speed up the loading of frequently used programs, which I'll explain a bit later. <br class="C" /></p>
<p>I set ultradefrag up after the MyDefrag 30hour defrag completes, to run at boot and control the prefetching, then I erase any prefetch files currently saved and reboot which lets it defrag the system.</p>
<pre>erase /Q "%SYSTEMROOT%\Prefetch\*.*"</pre>
<p>Once both MyDefrag and UltraDefrag have run THEN I finally login to windows and don't open any programs to let the windows OS files get optimized by not doing anything at all for 5 minutes..  Then I reboot and log back in and this time I don't do anything for 30 minutes and reboot.  Finally I log back in and this time I instantly load up 10 of my most frequently used programs, (DreamWeaver, Photoshop, Firefox, Chrome, Notepad2, Thunderbird, Internet Explorer, and a few others) and once they are all loaded I don't do anything for an hour.  Then I reboot and repeat that same process.</p>
<p>This may seem odd or made up but I do my research and this allows your prefetched files to be optimized, including your boot prefetch files.   Once that is done I reboot and run all the defrags again.  Then I reboot and am ready for the last step.</p>
<p><a href="http://ultradefrag.sourceforge.net/">Download UltraDefrag</a><br class="C" /></p>





<hr class="C" />
<p><a id="optimize-disk" name="optimize-disk"></a></p>
<h2>Optimize Physical Hard Disk</h2>
<p>Now at this point the system is defragged and optimized as much as I can get it, but the last step is to run a program to go over every single bit on our hard-drive-disk to keep the drive clean and healthy and its too technical for me to understand, I just know its amazingly cool and I noticed a big change right away.</p>


<h3>HD Tune</h3>
<p><img class="IFL" src="http://uploads.askapache.com/2009/10/HDTune_Benchmark-116x94.gif" alt="Windows Optimization   Intense Part II" title="HDTune_Benchmark" width="116" height="94" class="alignnone size-thumbnail wp-image-3425" />HD Tune is a fantastic little utility that you can use to benchmark the DISK IO speed of your various drives, internal and external, fixed and USB, firewire, etc..  Other than using it to determine your fastest drives for moving your program files and temps to, I am just including it in this article because it is an awesome program that you will love.<br class="C" /></p>
<p><a href="http://www.hdtune.com/download.html">Download HD Tune</a></p>


<h3>SpinRite</h3>
<p>This is the last step in this guide, and was the one thing that surprised me the most in terms of how much of a speed improvement I noticed after using it.  SpinRite is the most capable, thorough, and reliable utility that has ever been created for the long term maintenance, recovery, and repair of mass storage systems.   SpinRite is not a drive defragmenter. SpinRite operates with the drive's built-in intelligence to reassign and relocate defective sectors without creating file system fragments. Thus, running SpinRite does not create fragments, but neither does it eliminate any that may exist before it was run. Unlike any other disk utility, SpinRite interfaces directly to the hard disk system’s hardware, rather than working through the system’s operating system or BIOS.  <a href="http://www.grc.com/sr/faq.htm">FAQ</a>.</p>
<p class="anote">The way that we use SpinRite in this article is method #4, Drive Maintenance mode, which reads and writes and verifies every single sector and area of your hard drives, and improves the health of your hard drive a lot.  Even on my new 4K dell power laptop, this had a noticeable improvement on speed.  After running this 20+ hours for my fastest PC, I rebooted, defragged with jkdefrag, and that is the end of this article.</p>

<blockquote cite="http://www.grc.com/files/technote.pdf">
<p><h4>In case you don't already know . . . What is SpinRite?</h4>
<p>SpinRite is a stand-alone DOS application that specializes in the recovery of marginally or completely unreadable hard and floppy disk data, and in the lifetime maintenance of PC mass storage devices. It earned its stripes many years ago by introducing the concept of non-destructive low-level reformatting and sector interleave optimization. Since then its capabilities have continued to broaden until it has become the premiere tool for disk data recovery and magnetic mass storage drive maintenance. Written in assembly language, SpinRite still performs as well on a clunky old 4.77 megahertz PC/XT as on a screaming 333 megahertz Pentium II.</p></p>
</blockquote>
<p> While SpinRite 6.0 is running, you can toggle through seven displays:<br />
<img src="http://uploads.askapache.com/2009/10/spinrite-4.png" width="480" height="267" alt="Graphic Status Display" title="spinrite 4 windows" /><br />
<img src="http://uploads.askapache.com/2009/10/spinrite-5.png" width="480" height="267" alt="Real-Time Activities" title="spinrite 5 windows" /><br />
<img src="http://uploads.askapache.com/2009/10/spinrite-6.png" width="480" height="267" alt="Technical Log" title="spinrite 6 windows" /><br />
<img src="http://uploads.askapache.com/2009/10/spinrite-7.png" width="480" height="267" alt="S.M.A.R.T. System Monitor" title="spinrite 7 windows" /><br />
<img src="http://uploads.askapache.com/2009/10/spinrite-8.png" width="480" height="267" alt="DynaStat Data Recovery" title="spinrite 8 windows" /></p>
<p><a href="http://www.grc.com/cs/prepurch.htm">Purchase and Download SpinRite</a></p>






<hr class="C" /><hr class="C" /><hr class="C" /><p>More Reading</p>
<ul>
<li><a href="http://www.pcnet-online.com/picks/spinrite.htm">PCNet File Catch - SpinRite 6.0</a></li>
<li><a href="http://www.linuxjournal.com/article/7684">SpinRite 6.0 for Linux Users</a></li>
<li><a href="http://www.sysopt.com/tutorials/article.php/12034_3549006_1">Anticipate Drive Problems Early with SpinRite v6.0</a></li>
<li><a href="http://www.blackviper.com/WinXP/supertweaks.htm">Black Viper - Windows XP Super Tweaks</a></li>
<li><a href="http://www.blackviper.com/WinXP/custom_sc_bat_Pro.php">Black Viper - Optimize your Services</a></li>
<li><a href="http://www.horstmann.com/bigj/help/windows/advanced.html">Advanced Windows Shell Tutorial</a></li>
<li><a href="http://commandwindows.com/batch.htm">Batch Files (Scripts) in Windows </a></li>
<li><a href="http://proton.pathname.com/fhs/">File System Heirarchy</a></li>
<li><a href="http://www.grc.com/sn/sn-186.htm">Steve Gibson discussing Defragmenting</a></li>
</ul><p><a href="http://www.askapache.com/windows/defrag-optimize-speed-xp.html"></a><a href="http://www.askapache.com/windows/defrag-optimize-speed-xp.html">Windows Optimization &#8211; Intense Part II</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/windows/defrag-optimize-speed-xp.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

