<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>Tildemark blogs</title>
        <link>http://www.tildemark.com/</link>
        <description>Blogging on uniquely random things. </description>
        <language>en</language>
        <copyright>Copyright 2009</copyright>
        <lastBuildDate>Wed, 19 Nov 2008 06:03:03 +0800</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Adding www to your domain using 301 redirect with htaccess </title>
            <description><![CDATA[You can tell the server to automatically append www on each query to your website using .htaccess. That is all incoming requests to a non www query gets forwarded to the host with www prepended before the domain. Although google treats them equally now, yahoo and live search may not. So its still wise to add them to your website somehow. Its a great advantage to your site especialy in terms of search engine optimization. <br /><br />Here is the .htaccess script that forwards all request without www to your website having the www before the domain name. <br /><br />

<pre><code>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</code>
</pre>

Please note that this is only possible to websites that are hosted in either Linux or Unix servers running Apache]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/adding-www-to-your-domain-using-301-redirect-with-htaccess.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/adding-www-to-your-domain-using-301-redirect-with-htaccess.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">SEO</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Servers</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">htaccess</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">seo</category>
            
            <pubDate>Wed, 19 Nov 2008 06:03:03 +0800</pubDate>
        </item>
        
        <item>
            <title>Blocking unwanted referrers</title>
            <description><![CDATA[<p>Looks like my post to <a href="http://www.tildemark.com/programming/mod-rewrite/avoiding-hot-linking-to-images.html">avoid linking to hot images</a> is not working, now i'm getting 85% bandwidth usage on my website. When i try to view the logs got numerous referrers from profiles.myspace.com. Alright, i have decided to block all traffic from myspace, will do it using .htaccess.</p>

<p>RewriteCond %{HTTP_USER_AGENT} QihooBot [NC,OR]<br />
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?profile.myspace.com.*$ [NC]<br />
RewriteRule ^.* - [F]</p>

<p>Now, there is a bot that i have found so i added it anyway. :D If you wish to block some more add an or on the [NC] directive like this [NC,OR].</p>]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/blocking-unwanted-referrers.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/blocking-unwanted-referrers.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
            
            <pubDate>Thu, 19 Apr 2007 08:05:57 +0800</pubDate>
        </item>
        
        <item>
            <title>Redirecting 404 errors</title>
            <description><![CDATA[<p>we could redirect our users from a 404 error page not found to any url by editing our .htaccess files.  this is usefull to give us more control in handling vairous html error codes. using the ErrorDocument tag and specifying the error code 404 as the page not found error code, (other error code might also be used in the redirect like: 400 - Bad Syntax, 401 - Unauthorized, 402 - Not used, 403 - Forbidden, 404 - Not Found, 500 - Internal Error, 501 - Not Implemented, 502 - Overloaded, 503 - Gateway Timeout).</p>

<p>Redirecting to an error page:<br />
<div class="module-code"></p>

<p>ErrorDocument 404     /404.html<br />
- redirects the user to the 404.html page<br />
</div></p>

<p>using Rewrite to do the redirect:<br />
<div class="module-code"></p>

<p>RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteRule (.+)           http://www.tildemark.com/404page/$1<br />
</div></p>

<p>or </p>

<div class="module-code">

<p>RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteRule ^(.+)testing\.html?$ temporary/$1<br />
</div></p>

<p>Display an html page:<br />
<div class="module-code"></p>

<p>ErrorDocument 404  &lt;b&gt;Page Not Found&lt;/b&gt;&lt;p /&gt;&lt;br /&gt;&lt;a href="http://www.tildemark.com"&gt;Tildemark blogs homepage&lt;/a&gt;<br />
</div></p>]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/redirecting-404-errors.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/redirecting-404-errors.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
            
            <pubDate>Thu, 07 Dec 2006 07:16:34 +0800</pubDate>
        </item>
        
        <item>
            <title>Blocking Unwanted Robots</title>
            <description><![CDATA[<p>Spam is a problem, posting entries to blogs with email address should be avoided. There are lots of automated programs used to collect email addresses; other than spam, bandwidth may also be an issue for these programs reads your entire website. If you only have a small bandwidth allocated to your site then you will be seeing that Bandwidth Limit Error in due time. </p>

<p>What I did? Blocking all unwanted robots out of my site using mod_rewrite by apache. First, you need to examine your access log file ang try to google on the robots that has visited your site if they are safe or just they are just scrapers. Just be carefull not to block those major search engine spiders like googlebot, inktomi slurp, msnbot or ask jeeves. Unless you don't want them crawl your website. </p>

<p>You need to modify your .htaccess file to block unwanted robots from scraping your website by:<br />
<div class="module-powered module"><div class="module-content"><code>&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine on<br />
RewriteCond %{HTTP_USER_AGENT}      ^Siphon        [OR] <br />
RewriteCond %{HTTP_USER_AGENT}      ^Link[Ww]alker [OR] <br />
RewriteRule ^.*                     - [F]<br />
&lt;/IfModule mod_rewrite.c&gt;</code></div></div></p>

<p>The above code tells the spiders Siphon and LinkWalker that they are not allowed on our website by returning a 403 Forbidden Error. </p>

<p>There are also good robots, most of them are used for link checking, so redirecting them to the proper areas would be a better solution. <br />
<div class="module-powered module"><div class="module-content"><code>&lt;IfModule mod_rewrite.c&gt;<br />
RewriteCond %{HTTP_USER_AGENT}  reciprocalman [OR]<br />
RewriteCond %{HTTP_USER_AGENT}  LinksManager.com_bot<br />
RewriteRule  ^$                 /resources/<br />
&lt;/IfModule mod_rewrite.c&gt;</code></div></div></p>

<p>The code above tells the reciprocalman and the LinksManager.com_bot to go directly to the resources directory. </p>]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/blocking-unwanted-robots.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/blocking-unwanted-robots.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
            
            <pubDate>Wed, 13 Sep 2006 15:00:05 +0800</pubDate>
        </item>
        
        <item>
            <title>Avoiding Hot Linking to Images</title>
            <description><![CDATA[<p>Bandwidth is precious, and seeing a bandwidth limit exceeded on your website is just so frustrating. Blocking unwanted referrers from your site may be your best option. If you are using apache as your webserver then you can take advantage of its mod_rewrite module to block unwanted referrers. </p>

<p>You need to modify your .htaccess file to block access to large files such as, images, mpeg, avi, etc. :<br />
<div class="module-powered module"><div class="module-content"><code>&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine on<br />
RewriteCond %{HTTP_REFERER}                  !^$<br />
RewriteCond %{HTTP_REFERER}                  !^http://([-a-z0-9]+\.)?domain\.com [NC]<br />
RewriteRule .*\.(jpg|gif|avi|wmv|mpg|mpeg)$  http://www.domain.com/nohotlink.jpg [R,NC,L]<br />
&lt/ifModule&gt;</code></div></div><br />
</p>]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/avoiding-hot-linking-to-images.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/avoiding-hot-linking-to-images.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
            
            <pubDate>Thu, 07 Sep 2006 13:01:04 +0800</pubDate>
        </item>
        
        <item>
            <title>Redirect all to a www page</title>
            <description><![CDATA[<p>In apache, we can redirect pages having no www to its www counterpart without manualy adding the www on the url by using <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">mod_rewrite</a>. Like for example, try to type in my url as tildemark.com on your browser's address bar, hit Enter and automatically you will be redirected to http://www.tildemark.com. This is useful to avoid duplicate caching of pages and the division of your pages' PR.</p>

<p>We need to edit our .htaccess file to add the <a href="http://en.wikipedia.org/wiki/Http_status_codes">301</a> redirect. </p>

<div class="module-powered module">
<div class="module-content">
<code><pre>
# .htaccess file
# we need to check if mod_rewrite has been enabled, 
# by default its not
&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{HTTP_HOST}       ^tildemark.com
  RewriteRule (.*)               http://www.tildemark.com/$1 [R=301,L] 
&lt;/IfModule&gt;
</pre></code>
</div>
</div>

<p>Replace tildemark.com to your respective domain name. here's a <a href="http://www.ilovejackdaniels.com/apache/mod_rewrite-cheat-sheet/">mod_rewrite cheatsheet</a> from ilovejackdaniels.com </p>

<p>Notes:<br />
301 is an http status code meaning permanent redirect<br />
.htaccess files should be placed on the root directory<br />
PR is PageRank</p>]]></description>
            <link>http://www.tildemark.com/programming/mod-rewrite/redirect-all-to-a-www-page.html</link>
            <guid>http://www.tildemark.com/programming/mod-rewrite/redirect-all-to-a-www-page.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mod_rewrite</category>
            
            
            <pubDate>Fri, 18 Aug 2006 14:49:47 +0800</pubDate>
        </item>
        
    </channel>
</rss>






