<?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>The Developer</title>
	<atom:link href="http://www.thedeveloper.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thedeveloper.net</link>
	<description>examples</description>
	<lastBuildDate>Wed, 28 Sep 2011 19:12:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How do I get ls to display in color</title>
		<link>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html</link>
		<comments>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html#comments</comments>
		<pubDate>Wed, 28 Sep 2011 19:12:16 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[ls]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=88</guid>
		<description><![CDATA[Login as root and add the &#8211;color option to the command. ls -al &#8211;color /etc Open the .bashrc file with your favorite text editor. For example, you could type vi /root/.bashrc at the command line to open the file. Under the line &#8220;# User specific aliases and functions&#8221; type: alias ls=&#8221;ls -alh &#8211;color&#8221; alias ll=&#8221;ls -alh &#8211;color&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Login as root and add the &#8211;color option to the command.</p>
<p>ls -al &#8211;color /etc</p>
<p>Open the .bashrc file with your favorite text editor.<br />
For example, you could type <tt><strong>vi /root/.bashrc</strong></tt> at the command line to open the file.</p>
<p>Under the line &#8220;# User specific aliases and functions&#8221; type:</p>
<p>alias ls=&#8221;ls -alh &#8211;color&#8221;<br />
alias ll=&#8221;ls -alh &#8211;color&#8221;</p>
<p>Make sure to write your changes to the file and save them. The changes will not take effect until you close your terminal/session window and re-open a new terminal again.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/display-colors-linux-ls-command.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Thawte SSL certificate in nginx</title>
		<link>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html</link>
		<comments>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html#comments</comments>
		<pubDate>Tue, 27 Sep 2011 06:32:06 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=80</guid>
		<description><![CDATA[Thawte recently started issuing a new kind of SSL cert. Instead of just taking your crt and key files and dumping them on your server, you need to install Thawte’s intermediate certificates as well. here solution: Download your client certificate from thawte (.crt file thawte sent) Download the primary and secondary intermediate CAs Combine the 3 certificates into one [...]]]></description>
			<content:encoded><![CDATA[<p>Thawte recently started issuing a new kind of SSL cert. Instead of just taking your crt and key files and dumping them on your server, you need to install Thawte’s intermediate certificates as well.</p>
<p><strong>here solution:</strong></p>
<ol>
<li>Download your client certificate from thawte (.crt file thawte sent)</li>
<li>Download the <a href="https://search.thawte.com/support/ssl-digital-certificates/index?page=content&amp;id=AR1482&amp;actp=LIST&amp;viewlocale=en_US" target="_blank">primary and secondary intermediate CAs</a></li>
<li>Combine the 3 certificates into one file, with your certificate first, then the primary and secondary intermediate certificates.</li>
<li>Add: ssl_verify_depth 3; to your configuration file</li>
<li>Restart nginx (/etc/init.d/nginx restart)</li>
</ol>
<p>So in the end, your nginx configuration file should look like the following:</p>
<blockquote><p>ssl_certificate         /path/to/certificate.bundle.cert;<br />
ssl_certificate_key     /path/to/private.key;<br />
ssl_verify_depth 3;</p></blockquote>
<p>Now your browser should say that the certificate was issues by Thawte DV SSL CA.<br />
Test it by visiting <a title="Test SSL" href="https://www.ssllabs.com/ssldb/" target="_blank">https://www.ssllabs.com/ssldb/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/nginx/install-thawte-ssl-cert.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Qmail-Remove</title>
		<link>http://www.thedeveloper.net/linux/qmail-remove.html</link>
		<comments>http://www.thedeveloper.net/linux/qmail-remove.html#comments</comments>
		<pubDate>Sat, 13 Mar 2010 03:00:53 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=68</guid>
		<description><![CDATA[Qmail-Remove will remove messages containing a particular string from your Qmail queue. Mails are *not* deleted from the queue! They are only stored, temporarily, in $qmail-queue/yanked/, where you can view them individually and restore them back to the queue manually. There is currently no support for restoring them automatically. By default, Qmail-Remove assumes that your [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-70" style="margin-left: 10px;margin-right: 10px" title="qmail remove emails" src="http://www.thedeveloper.net/files/2010/03/qmail1-150x150.jpg" alt="" width="115" height="115" />Qmail-Remove will remove messages  containing a particular string from your Qmail queue.</p>
<p>Mails are *not* deleted from the queue! They are only stored,  temporarily, in $qmail-queue/yanked/, where you can view them  individually and restore them back to the queue manually. There is  currently no support for restoring them automatically.</p>
<p>By default, Qmail-Remove assumes that your Qmail queue is stored in  /var/qmail/queue, but this can be changed with a command line option.  Similarly, Qmail-Remove assumes that your queue “split” is 23 by  default, among other things.</p>
<p>If you want to check your qmail queue using the following command</p>
<p>#<span style="color: yellowgreen"> /var/qmail/bin/qmail-qstat</span></p>
<p>Output looks like</p>
<p>messages in queue: 567154<br />
messages in queue but not yet preprocessed: 3</p>
<p>Install Qmail-Remove</p>
<p>First you need to download latest version from here current version is  Qmail-Remove 0.95</p>
<p>Download using the following command</p>
<p>#wget <a href="http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-.tar.gz" target="_blank">http://www.linuxmagic.com/opensource&#8230;remove-.tar.gz</a></p>
<p>Now you have qmail-remove-0.95.tar.gz file and now you need to extract  using the following command</p>
<p>#<span style="color: yellowgreen">tar -zxvf qmail-remove-.tar.gz</span></p>
<p>Now you should have qmail-remove-0.95 folder go in to the directory and  run the following commands</p>
<p>#<span style="color: yellowgreen">make</span></p>
<p>#<span style="color: yellowgreen">make install</span></p>
<p>This will complete the installation.</p>
<p>Now you need to create a directory named “yanked” in the qmail queue  directory you intend to use before using this program.</p>
<p>#<span style="color: yellowgreen">mkdir /var/qmail/queue/yanked</span></p>
<p><strong>Examples for qmail-remove</strong></p>
<p>Before doing any thing related to qmail queue you need to stop the qmail  service using the following command:</p>
<p>#<span style="color: yellowgreen">/etc/init.d/qmail stop</span></p>
<p>To delete mails from Que,</p>
<p>#<span style="color: yellowgreen">qmail-remove -r -p</span></p>
<p># <span style="color: yellowgreen">qmail-remove -r -p mega.pack.com</span></p>
<p>This will remove all emails in queue with “mega.pack.com” in it and place  it in /var/qmail/queue/yanked folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/linux/qmail-remove.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have a problem with mod_rewrite rules? Debug it !</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:06:59 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[rules]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=64</guid>
		<description><![CDATA[Many webmasters run in to mod_rewrite at one time or another and every one of them will have at least a little trouble with it. I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive. To set up a debugging log for mod_rewrite, you need to add them to your httpd.conf to the appropriate [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-57" style="margin-left: 10px; margin-right: 10px;" title="mod_rewrite logo" src="http://www.thedeveloper.net/files/2010/01/mod_rewrite_logo-150x126.jpg" alt="" width="150" height="126" />Many webmasters run in to <strong>mod_rewrite</strong> at one time or another and every one of them will have at least a little trouble with it.<br />
I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive.<span id="more-64"></span><br />
To set up a <strong>debugging log</strong> for <strong>mod_rewrite</strong>, you need to add them to your <strong>httpd.conf</strong> to the appropriate VirtualHost section.</p>
<ul>
<li>Add following rules to your httpd.conf
<pre class="brush: bash; title: ; notranslate">
&lt;IfModule mod_rewrite.c&gt;
RewriteLog &quot;/var/log/httpd/rewrite.log&quot;
RewriteLogLevel 3
&lt;/IfModule&gt;
</pre>
<p>to the appropriate VirtualHost section.</li>
<li>Restart Apache by command in your shell (as root)<br />
<strong><em>apachectl graceful</em></strong></li>
</ul>
<p><strong>Note:</strong> You&#8217;re not going to be able to turn above rules with shared hosting, they can&#8217;t be used in .htaccess by default. But you could ask your server-administrator to set AllowOverride to &#8220;All&#8221; instead &#8220;None&#8221;. And you will available to add above rules to .htaccess.</p>
<p>There a trick that&#8217;s helps  debug mod_rewrite on shared hosting even AllowOverride is &#8220;None&#8221;.<br />
Basically what you do is dump some of the info that mod_rewrite is  using back out into the headers then use the <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a> or <a href="http://livehttpheaders.mozdev.org/">LiveHTTP Headers</a> extensions in Firefox to watch the headers and read your debug info.<br />
Add following rules to .htaccess:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{QUERY_STRING} !vardump
RewriteRule (.*) http://www.your_website.com/$1?vardump&amp;thereq=%{THE_REQUEST}&amp;reqhost=%{HTTP_HOST} [R=301,L,QSA]
</pre>
<p>to dump, for example, the THE_REQUEST and HTTP_HOST into request variables.<br />
The R=301 does a 301 redirect instead of a rewrite &#8211; this is key. A redirect sends information back to the browser but a rewrite happens all inside the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/mod_rewrite-rules-debug-log.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rewrite subdomain to folder</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:40:29 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=59</guid>
		<description><![CDATA[You might have noticed some sites having their URLs written as if they were different subdomains of the same domain. Internally rewrite .example.com/ to example.com/subs/&#60;subdomain/ Internally rewrite .example.com/ to example.com/&#60;subdomain/ In both cases, a mechanism is required (and present in the code) to prevent an &#8216;infinite&#8217; rewriting loop. If you use the first method, then [...]]]></description>
			<content:encoded><![CDATA[<p>You might have noticed some sites having their URLs written as if they were different subdomains of the same domain.<span id="more-59"></span></p>
<p>Internally rewrite .example.com/ to example.com/subs/&lt;subdomain/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond $1 !^subs/
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /subs/%1/$1 [L]
</pre>
<p>Internally rewrite .example.com/ to example.com/&lt;subdomain/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{ENV:Rewrite-Done} !^Yes$
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /%1/$1 [E=Rewrite-Done:Yes,L]
</pre>
<p>In both cases, a mechanism is required (and present in the code) to prevent an &#8216;infinite&#8217; rewriting loop.</p>
<p>If you use the first method, then you can easily externally redirect direct client requests for the subdomain-subdirectories back to the subdomain to avoid duplicate content:</p>
<p>Externally redirect client requests for example.com/subs// to .example.com/</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /subs/
RewriteRule ^subs/([^/]+)/(.*)$ http://$1.example.com/$2 [R=301,L]
</pre>
<p><strong>Here more complex email</strong><br />
The best way to do this is to setup each (or all) subdomain in the sites/{subdomain} directory of domain.com via your control panel. Some hosts will leave well enough alone (so the subdomain remains visible) but others actually force a redirect to the main domain&#8217;s subdirectory (forcing a change of URL). If you do this with mod_rewrite, you are forcing the change of URL.</p>
<pre class="brush: bash; title: ; notranslate">
# Rewrite &lt;subdomain&gt;.example.com/&lt;path&gt; to example.com/SITE/&lt;subdomain&gt;/&lt;path&gt;
#
# Skip rewrite if no hostname or if subdomain is www
# RewriteCond %{HTTP_HOST} .
# there must always be an {HTTP_HOST}
RewriteCond %{HTTP_HOST} !^www\. [NC]

# Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2)
RewriteCond %{HTTP_HOST}&lt;&gt;%{REQUEST_URI} ^([^.]+)\.domain\.com(:80)?&lt;&gt;/([^/]*) [NC]
# / is not used by Apache 2.x
# ([^/]*) means no subdirectories allowed

# Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion)
RewriteCond %1&lt;&gt;%3 !^sites/(.*)&lt;&gt;\1$ [NC]
# Don't forget your sites &quot;marker&quot; subdirectory
# \1$ has no meaning!  All you don't want it sites/ in the URI

RewriteCond %{REQUEST_URI} !^/?sites/
# so you don't need the preceding RewriteCond statement

RewriteRule ^(.*) sites/%1/$1 [R=301,L]
# You might as well make this a 301 redirect
# finis!

    # Rewrite to /subdomain/path
    #RewriteRule ^(.*) /sites/%1/$1 [L]
    #RewriteRule ^(.*) /%1/$1 [L] #root directory
    #RewriteRule ^(.*) sites/%1/$1 [L]
    #RewriteRule ^/products/ index.php?id=$1&amp;todo=
</pre>
<p>To check whether the folder exists is redundant &#8211; Apache will NOT even receive the request if the subdomain doesn&#8217;t exist so this problem can only occur with Dynamic Mass VirtualHosting. In that case, use a RewriteCond statement to check {PHYSICAL path to DocumentRoot}/sites/%1 -d (directory exists).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/rewrite-subdomain-to-folder.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Mod_Rewrite Rules You Should Know</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/mod-rewrite-rules.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/mod-rewrite-rules.html#comments</comments>
		<pubDate>Sun, 31 Jan 2010 00:58:54 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=38</guid>
		<description><![CDATA[Turn Mod_Rewrite On Mod_rewrite is used through your .htaccess file. Place the following code at the beginning of your .htaccess file to turn mod_rewrite on: RewriteEngine on (Don’t forget that .htaccess commands are case-sensitive.) This code needs to be entered at the beginning of any .htaccess file using mod_rewrite. The Basic Mod_Rewrite Layout The basic [...]]]></description>
			<content:encoded><![CDATA[<h3>Turn Mod_Rewrite On</h3>
<p>Mod_rewrite is used through  your .htaccess file. Place the following code at the beginning of your  .htaccess file to turn mod_rewrite on:<span id="more-38"></span></p>
<pre>RewriteEngine on</pre>
<p>(Don’t forget that .htaccess commands are case-sensitive.) This  code needs to be entered at the beginning of any .htaccess file using  mod_rewrite.</p>
<h3>The Basic Mod_Rewrite Layout</h3>
<p>The  basic format for a mod_rewrite command is:</p>
<pre>RewriteRule Pattern Substitution [Flag(s)]</pre>
<h3>URLs are Always Relative</h3>
<p>The URL you  redirect to is always relative to the directory in which your .htaccess  file is placed. So if it’s in the root directory, URLs are all in  relation to the root directory; if it’s in a sudirectory, URLs are in  relation to that particular subdirectory.</p>
<h3>A Basic  Redirect</h3>
<p>If you just want to create a simple 301 redirect from  one URL to another, then use the following code:</p>
<pre>RewriteRule ^fileone.html$ filetwo.html</pre>
<p>This is a very basic rule that means any requests for  fileone.html will be sent to filetwo.html.</p>
<h3>Require  no “www”</h3>
<p>This bit of code will make it so visitors to your site  don’t need to type in the “www” bit of your website address.</p>
<pre>RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]</pre>
<h3>Block a Specific IP Address</h3>
<p>If you want  to block someone coming from a specific IP address from accessing your  website, you can use the following code:</p>
<pre>RewriteCond %{REMOTE_ADDR} ^(A\.B\.C\.D)$
RewriteRule ^/* http://www.domain.com/sorry.html [L]</pre>
<p>Replace the A\.B\.C\.D with the IP address you want to block  (don’t forget to leave the “\” before each dot, which escapes the  character).</p>
<h3>Block Specific User Agents</h3>
<p>If  you want to block a group of IP addresses using the same User Agent  (bot), the following code with do it:</p>
<pre>RewriteCond %{HTTP_USER_AGENT} UserAgent
RewriteRule .* - [F,L]</pre>
<p>Just replace the “UserAgent” bit with whatever user agent you  want to block. You can also block more than one at a time by replacing  the top line in that code with something like this:</p>
<pre>RewriteCond %{HTTP_USER_AGENT} UserAgentA [OR]
RewriteCond %{HTTP_USER_AGENT} UserAgentB</pre>
<p>You can put as many user agents in as you want, just make sure  you end each line with [OR] (with the exception of the last line, of  course).</p>
<h3>Strip Query Strings</h3>
<p>Let’s  say all the pages on your site other than your home page are formatted  as follows, with query strings instead of page names:</p>
<p>http://www.domain.com/home.html?example=12345abcd</p>
<p>Those  aren’t very pretty, and on top of that, search engines will show a  bunch of duplicated “home” pages. If you want to get rid of the query  string in your page URLs, use the following code:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{QUERY_STRING} example=
RewriteRule (.*) http://www.domain.com/$1? [R=301]
</pre>
<p>This not only gets rid of the query string, but also the  preceding question mark.</p>
<p>&nbsp;</p>
<h3>Set up a Default Image</h3>
<p>Using  a default, backup image in case of broken images can make your site  look more professional. Use the following code to redirect to a default  image for any image whose file cannot be found.</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^images/.*\.jpg$ /images/default.jpg [L]
</pre>
<p>Of course, you can change the “.jpg” bit to whatever file type  you’re using. Make sure you have an image called “default.jpg” or change  that to whatever your default image filename is.</p>
<p>&nbsp;</p>
<h3>Prevent  Hotlinking</h3>
<p>The last thing most website owners want is other  sites stealing their content or worse—hotlinking to their images and  stealing their bandwidth. Here’s a simple bit of code that prevents it:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/ .*$ [NC]
RewriteRule \.(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]
</pre>
<p>Make sure you change the “domain.com” bit to your own domain  name.</p>
<p>&nbsp;</p>
<h3>Redirect to a Maintenance Page</h3>
<p>If you  need to take your entire site offline for a bit and redirect to a  maintenance page (or some other page), use the following code:</p>
<pre>RedirectMatch 302 ^/ /maintenancepage.html</pre>
<p>Change the “maintenancepage.html” bit to wherever your  maintenance page file is located.</p>
<h3>Redirect Multiple  Domains to a Single Domain</h3>
<p>If you have multiple domains pointing  to your site, it’s possible you could take a hit in the search engines  for having duplicate content. Use the following code to redirect  visitors from two domains to just one:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteCond %{HTTP_HOST} ^www.domain.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domain.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.net$ [NC]
RewriteRule ^(.*)$ http://domain.net/$1 [R=301,L]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/mod-rewrite-rules.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod Rewrite Cheat Sheet</title>
		<link>http://www.thedeveloper.net/apache/mod_rewrite/cheat-sheet.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_rewrite/cheat-sheet.html#comments</comments>
		<pubDate>Sun, 31 Jan 2010 00:48:11 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Rewrite]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=32</guid>
		<description><![CDATA[Mod_Rewrite Cheat Sheet, a quick reference guide for mod_rewrite, with rewrite flags, regular expression syntax and sample rules. download mod_rewrite cheat sheet in pdf download mod_rewrite cheat sheet in png Regular Expression Syntax URL Rewriting with mod_rewrite depends a great deal upon a solid knowledge and understanding of regular expressions. The &#8220;RewriteRule&#8221; uses regular expressions [...]]]></description>
			<content:encoded><![CDATA[<p>Mod_Rewrite Cheat Sheet, a quick reference guide for mod_rewrite, with  rewrite flags, regular expression syntax and sample rules.</p>
<p><a href="http://www.thedeveloper.net/files/2010/01/mod_rewrite-cheat-sheet-v2.pdf">download mod_rewrite cheat sheet in pdf</a></p>
<p><a href="http://www.thedeveloper.net/files/2010/01/mod_rewrite-cheat-sheet-v2.png">download mod_rewrite cheat sheet in png</a></p>
<h3>Regular Expression Syntax</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_1.png" alt="Thumbnail highlighting regular expression syntax." /> URL Rewriting with mod_rewrite depends a great deal upon a solid knowledge and understanding of regular expressions. The &#8220;RewriteRule&#8221; uses regular expressions in patterns extensively. This guide outlines the basic syntax of regular expression.</p>
<h3>RewriteRule and RewriteCond Flags</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_2.png" alt="Thumbnail highlighting rewrite rule flags." /> Rewrite Rules in mod_rewrite can have flags appended to them, indicating to the server how the action described by the rule should be taken. For example, the &#8216;L&#8217; flag tells the server not to process any more rules if the current rule is used.</p>
<p>Conditions in mod_rewrite can also have flags appended to them, and again these tell the server how to interpret the current condition. The &#8220;NC&#8221; flag indicates the condition is case-insensitive, and an &#8220;OR&#8221; flag between conditions tells the server that the following rule should be applied if any of the preceding conditions are true. The default in mod_rewrite is that, if a rule is preceded by a list of conditions, it should only be applied if all conditions are met.</p>
<h3>Redirection Header Codes</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_3.png" alt="Thumbnail highlighting redirection header codes." /> When redirecting users with mod_rewrite, sometimes a status code must be sent back to the user. This status code is interpreted by the browser &#8211; sometimes it will mean the user is sent on to a new page, sometimes that they are shown a message. This section lists the most commonly used status codes with their meanings.</p>
<h3>Example Rules</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_4.png" alt="Thumbnail highlighting example rules." /> This section lists a few of the most situations mod_rewrite is used for, along with a rule to achieve the desired affect.</p>
<h3>Server Variables</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_5.png" alt="Thumbnail highlighting server variables." /> Sometimes it is necessary to rewrite URLs based upon variables like the referring URL or the browser being used. These variables can be used in mod_rewrite (including in the RewriteRule or RewriteCond sections), and this section lists the variables available.</p>
<h3>Directives</h3>
<p><img class="cheatsheetthumbnail" src="http://www.addedbytes.com/cheat-sheets/thumbnails/mod_rewrite_v2_6.png" alt="Thumbnail highlighting directives." /> mod_rewrite gives the server a series of instructions, called directives. For example, &#8220;RewriteEngine On&#8221; tells Apache that RewriteRules may be used and to interpret them if found. This section simply lists the directives used by mod_rewrite.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_rewrite/cheat-sheet.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mod_deflate  alternative way for css and javascript through mod_rewrite rules</title>
		<link>http://www.thedeveloper.net/apache/mod_deflate/alternative-throught-apache-mod_rewrite.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_deflate/alternative-throught-apache-mod_rewrite.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 03:01:06 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Deflate]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=25</guid>
		<description><![CDATA[This method is probably the best method to overcome the mod_deflate issue and we are only concerned about javascript and css files for now. What we need to do is gzip all our javascript &#38; css files. (Note: PHP has an easy method to compress php files on the fly). You have to have shell [...]]]></description>
			<content:encoded><![CDATA[<p>This method is probably the best method to overcome the mod_deflate issue and we are only concerned about javascript and css files for now. What we need to do is gzip all our javascript &amp; css files. (Note: PHP has an easy method to compress php files on the fly).</p>
<p>You have to have shell access to your server/website.  Run follow command will find each and every javascript file and css file and create a gzip copy.</p>
<pre class="brush: bash; title: ; notranslate">
cd /folder_to_your_website_root_folder
find . -regex &quot;.*\(css\|js\)$&quot; -exec bash -c 'echo Compressing &quot;{}&quot; &amp;&amp; gzip -c --best &quot;{}&quot; &gt; &quot;{}.gz&quot;' \;
</pre>
<p>The line above searches the current directory and any subdirectories for files with extensions <strong>.js</strong> or <strong>.css</strong>, then prints out that it is being compressed, then compresses with the highest compression in that directory leaving the original file as is.</p>
<p>Now, we need to tell our browser to access the <strong>gzip</strong> version *IF* it supports gzip encoding.<br />
To do this, we use the following in our <strong>.htaccess</strong> file ( create that file if not exists in your website root folder)</p>
<pre class="brush: bash; title: ; notranslate">
&lt;files *.js.gz&gt;
	AddType &quot;text/javascript&quot; .gz
	AddEncoding gzip .gz
&lt;/files&gt;
&lt;files *.css.gz&gt;
	AddType &quot;text/css&quot; .gz
	AddEncoding gzip .gz
&lt;/files&gt;

RewriteEngine on
#Check to see if browser can accept gzip files.
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari

#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$

#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f

#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]
</pre>
<p>The advantage of above method is that our server doesn’t have to<strong> gzip / compress</strong> the <strong>javascript</strong> and <strong>css</strong> each time it is called. This eases the load up on the server as we already do the compression one time and then just call the compressed version from then after. (the method is very useful if you are running a VPS with very low memory available)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_deflate/alternative-throught-apache-mod_rewrite.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compress html output, css &amp; javascript with mod_deflate module in Apache 2</title>
		<link>http://www.thedeveloper.net/apache/mod_deflate/compress-html-output-css-javascript.html</link>
		<comments>http://www.thedeveloper.net/apache/mod_deflate/compress-html-output-css-javascript.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 02:35:29 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Deflate]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/?p=18</guid>
		<description><![CDATA[.htaccess configuration Normally be able to enable mod_deflate module for Apache2 safely with the following lines inside your .htaccess file in your www root of your website: Virtual Host Notes Some people argue that configuration in the VHost is better because it saves your server the disk IO of accessing the .htaccess file with every [...]]]></description>
			<content:encoded><![CDATA[<h3>.htaccess configuration</h3>
<p>Normally be able to enable <strong>mod_deflate</strong> module for <strong>Apache2</strong> safely with the following lines inside your .htaccess file in your www root of your website:</p>
<pre class="brush: bash; title: ; notranslate">
&lt;ifmodule mod_deflate.c&gt;
	# Insert filter
	SetOutputFilter DEFLATE

	# Compress Level 9 - maximum
	DeflateCompressionLevel 9

	# Netscape 4.x has some problems...
	BrowserMatch ^Mozilla/4 gzip-only-text/html

	# Netscape 4.06-4.08 have some more problems
	BrowserMatch ^Mozilla/4\.0[678] no-gzip

	# MSIE masquerades as Netscape, but it is fine
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

	# Don't compress images
	SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

	# Don't compress archives and pdf
	SetEnvIfNoCase Request_URI \
	    \.(?:exe|t?gz|zip|bz2|sit|rar|pdf)$ \
	    no-gzip dont-vary

	# Make sure proxies don't deliver the wrong content
	Header append Vary User-Agent env=!dont-vary
&lt;/ifmodule&gt;
</pre>
<h3>Virtual Host Notes</h3>
<p>Some people argue that configuration in the VHost is better because it saves your server the disk IO of accessing the .htaccess file with every request (Note: for VHost configuration you will need to be admin of your server).<br />
Save above rules in a file, named <strong>mod_deflate.conf</strong> and copy the file to <code>/etc/httpd/conf.d//etc/httpd/conf.d</code> (CentOS)</p>
<h3>Testing</h3>
<p>To test if mod_deflate is work, go to  <a href="http://www.whatsmyip.org/http_compression/" target="_blank">http://www.whatsmyip.org/http_compression/</a> and we enter the whole URL to your website or stylesheet or javascript file. You should see a <span style="color: #008000"><strong>big green tick</strong></span> and the site will say the PAGE or CSS or JAVASCRIPT  is compressed.</p>
<h3>Website Performance</h3>
<p>Also, here a <a href="http://www.websiteoptimization.com/services/analyze/" target="_blank">Free Website Performance Tool and Web Page Speed Analysis</a> Enter a URL below to calculate page size, composition, and download time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/mod_deflate/compress-html-output-css-javascript.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tricks to disable rules</title>
		<link>http://www.thedeveloper.net/apache/modsecurity/disabling-rules-tricks.html</link>
		<comments>http://www.thedeveloper.net/apache/modsecurity/disabling-rules-tricks.html#comments</comments>
		<pubDate>Wed, 20 Jan 2010 03:45:44 +0000</pubDate>
		<dc:creator>Amaga</dc:creator>
				<category><![CDATA[Mod_Security]]></category>

		<guid isPermaLink="false">http://www.thedeveloper.net/apache/modsecurity/disabling-rules-tricks.html</guid>
		<description><![CDATA[1 Disabling Mod_Security Globally 2 Disabling Mod_security per domain 3 Disable Mod_security on a global URL 4 Disable a Mod_security rule (or rules) for all applications in a single domain 5 Disable Mod_security rule for a specific application in a single domain 6 Disable Mod_security rule for all domains 7 Disable Mod_security rules globally for [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disabling_Mod_Security_Globally">1 Disabling Mod_Security Globally</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disabling_Mod_security_per_domain">2 Disabling Mod_security per domain</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_Mod_security_on_a_global_URL">3 Disable Mod_security on a global URL</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_a_Mod_security_rule_.28or_rules.29_for_all_applications_in_a_single_domain">4 Disable a Mod_security rule (or rules) for all applications in a single domain</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_Mod_security_rule_for_a_specific_application_in_a_single_domain">5 Disable Mod_security rule for a specific application in a single domain</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_Mod_security_rule_for_all_domains">6 Disable Mod_security rule for all domains</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_Mod_security_rules_globally_for_a_specific_application">7 Disable Mod_security rules globally for a specific application</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Disable_Mod_security_rules_by_domain.2C_for_a_specific_application.2C_for_a_list_of_IPs">8 Disable Mod_security rules by domain, for a specific application, for a list of IPs</a></li>
<li><a href="http://www.atomicorp.com/wiki/index.php/Mod_security#Configuring_and_Setting_up_mod_security">9 Configuring and Setting up mod_security</a></li>
</ul>
<h2>Disabling Mod_Security Globally</h2>
<p>Step 1) Disable config file</p>
<pre>mv /etc/httpd/conf.d/00_mod_security.conf /etc/httpd/conf.d/00_mod_security.conf.disabled
</pre>
<p>Step 2) Restart Apache</p>
<pre>service httpd restart
</pre>
<h2>Disabling Mod_security per domain</h2>
<p>Step 1) Edit the vhost/vhost_ssl.conf for the domain</p>
<pre> vim /var/www/vhosts/&lt;DOMAINNAME&gt;/conf/vhost.conf
</pre>
<p>Step 2) Add the following</p>
<pre>&lt;IfModule mod_security2.c&gt;
  SecRuleEngine Off
&lt;/IfModule&gt;
</pre>
<p>Step 3) Add vhost.conf to domain config</p>
<pre>/usr/local/psa/admin/bin/websrvmng -a
</pre>
<p>Step 4) Restart Apache</p>
<pre>service httpd restart
</pre>
<h2>Disable Mod_security on a global URL</h2>
<p>Step 1) Create a global exclude file</p>
<pre>vim /etc/httpd/modsecurity.d/00_asl_custom_exclude.conf
</pre>
<p>Step 2) Add the LocationMatch for the url to exclude. Example: /server.php</p>
<pre>&lt;LocationMatch /server.php&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleEngine Off
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p>Step 3) Restart apache</p>
<pre>service httpd restart
</pre>
<p><strong>Disable a Mod_security rule (or rules) for all applications in a single domain</strong></p>
<p>Step 1) Edit the vhost/vhost_ssl.conf for the domain</p>
<pre>vim /var/www/vhosts/&lt;DOMAINNAME&gt;/conf/vhost.conf
</pre>
<p>Step 2) Add the LocationMatch for the rule to exclude. Example, ruleid 950005</p>
<pre>&lt;LocationMatch .*&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 950005
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p>If you want to disable multiple rules:</p>
<p>Step 2)  Add the LocationMatch for the rule to exclude. Example, ruleids 950005 and 950006</p>
<pre>&lt;LocationMatch .*&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 950005
    SecRuleRemoveById 950006
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p><strong>Disable Mod_security rule for a specific application in a single domain</strong></p>
<p>Step 1) Edit the vhost/vhost_ssl.conf for the domain</p>
<pre>vim /var/www/vhosts/&lt;DOMAINNAME&gt;/conf/vhost.conf
</pre>
<p>Step 2) Add the LocationMatch for the rule to exclude. Example, ruleid 950005</p>
<pre>&lt;LocationMatch /URL/path/to/application.php&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 950005
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<h2>Disable Mod_security rule for all domains</h2>
<p>Use ASL utility to disable rule by ID. Example: 950005</p>
<pre>asl --disable-signature 950005
</pre>
<p>Note: This requires that <a title="Atomic Secured Linux" href="http://www.atomicorp.com/wiki/index.php/Atomic_Secured_Linux">Atomic Secured Linux</a> be installed.</p>
<p>If you do not have <a title="Atomic Secured Linux" href="http://www.atomicorp.com/wiki/index.php/Atomic_Secured_Linux">Atomic Secured Linux</a> you can disable a rule globally manually by adding a rule like this:</p>
<pre>&lt;LocationMatch .*&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 340000
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<h2>Disable Mod_security rules globally for a specific application</h2>
<p>Add this to either you vhost.conf file, or if your want to make this global make sure this exclusion is loaded after your rules are loaded. A good place to add this in the 999_asl_user_exclude.conf file. If you don&#8217;t have this file, just create it. The system is smart enough to know to load it.</p>
<pre>&lt;LocationMatch /url/to/your/application&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRuleRemoveById 1234567
    SecRuleRemoveById 9999999
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p>Whats important to remember is that the LocationMatch variable must match the URL, not the path on the system.</p>
<h2>Disable Mod_security rules by domain, for a specific application, for a list of IPs</h2>
<p>Step 1) Edit the vhost/vhost_ssl.conf for the domain</p>
<pre>vim /var/www/vhosts/&lt;DOMAINNAME&gt;/conf/vhost.conf
</pre>
<p>Step 2) Add the LocationMatch for the rule to exclude.</p>
<pre>&lt;LocationMatch /foo/bar.php&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRule REMOTE_ADDR "@pmFromFile /etc/asl/whitelist" "nolog,phase:1,allow"
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p>Step 3) Add IP to /etc/asl/whitelist</p>
<pre>echo "10.11.12.13" &gt;&gt; /etc/asl/whitelist
</pre>
<p>Or:</p>
<p>If you want to create a special whitelist for just that application:</p>
<p>Step 1) Edit the vhost/vhost_ssl.conf for the domain</p>
<pre>vim /var/www/vhosts/&lt;DOMAINNAME&gt;/conf/vhost.conf
</pre>
<p>Step 2) Add the LocationMatch for the rule to exclude.</p>
<pre>&lt;LocationMatch /foo/bar.php&gt;
  &lt;IfModule mod_security2.c&gt;
    SecRule REMOTE_ADDR "@pmFromFile /path/to/your/custom/whitelist_for_this_application" "nolog,phase:1,allow"
  &lt;/IfModule&gt;
&lt;/LocationMatch&gt;
</pre>
<p>Step 3) Create your custom whitelist and add IP to /etc/asl/whitelist</p>
<pre>echo "10.11.12.13" &gt;&gt; /path/to/your/custom/whitelist_for_this_application
</pre>
<p>Keep</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedeveloper.net/apache/modsecurity/disabling-rules-tricks.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

