<?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/"
xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Yoast &#187; Apache</title> <atom:link href="http://yoast.com/tag/apache/feed/" rel="self" type="application/rss+xml" /><link>http://yoast.com</link> <description>Tweaking Websites</description> <lastBuildDate>Mon, 21 May 2012 18:33:54 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.4-beta4-20825</generator> <image><title>Yoast</title> <url>http://yoast.com/wp-content/themes/yoast-v2/images/yoast-logo-rss.png</url><link>http://yoast.com</link> <width>144</width> <height>103</height> <description>Tweaking Websites</description> </image> <item><title>WordPress Hosting</title><link>http://yoast.com/wordpress-hosting-comment/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-hosting-comment</link> <comments>http://yoast.com/wordpress-hosting-comment/#comments</comments> <pubDate>Tue, 22 Dec 2009 16:06:51 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[Hosting]]></category> <category><![CDATA[WordPress Hosting]]></category><guid
isPermaLink="false">http://yoast.com/?p=1904</guid> <description><![CDATA[<p>You can find my WordPress hosting article here, because of an experiment the comments for that article are here, while the article itself is "on it's own".</p><p><a
href="http://yoast.com/wordpress-hosting-comment/">WordPress Hosting</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>You can find my <a
href="http://yoast.com/articles/wordpress-hosting/">WordPress hosting</a> article here, because of an experiment the comments for that article are here, while the article itself is "on it's own".</p><p><a
href="http://yoast.com/wordpress-hosting-comment/">WordPress Hosting</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/wordpress-hosting-comment/feed/</wfw:commentRss> <slash:comments>133</slash:comments> </item> <item><title>Preventing your site from being indexed, the right way</title><link>http://yoast.com/prevent-site-being-indexed/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prevent-site-being-indexed</link> <comments>http://yoast.com/prevent-site-being-indexed/#comments</comments> <pubDate>Thu, 17 Dec 2009 14:41:26 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[SEO]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[robots.txt]]></category><guid
isPermaLink="false">http://yoast.com/?p=1894</guid> <description><![CDATA[<p>It keeps amazing me that I keep seeing people use robots.txt files to prevent sites from being indexed and thus showing up in the search engines. You know why it keeps amazing me? Because robots.txt doesn't actually do the latter, even though it does prevent your site from being indexed. Let's go through some terms [...]</p><p><a
href="http://yoast.com/prevent-site-being-indexed/">Preventing your site from being indexed, the right way</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>It keeps amazing me that I keep seeing people use <em>robots.txt</em> files to prevent sites from being indexed and thus showing up in the search engines. You know why it keeps amazing me? Because <em>robots.txt</em> doesn't actually do the latter, even though it does prevent your site from being indexed.</p><p>Let's go through some terms here:</p><p><strong>Indexed / Indexing</strong><br
/> The process of downloading a site or a page's content to the server of the search engine, thereby adding it to it's "index".</p><p><strong>Ranking / Listing / Showing</strong><br
/> Showing a site in the search result pages (aka <abbr
title="Search Engine Result Pages">SERPs).</abbr></p><p>So, while the most common process goes from Indexing to Listing, a site <em>doesn't have to be indexed</em> to be listed. If a link points at a page, domain or wherever, that link will be followed. If the <em>robots.txt</em> on that domain prevents the search engine from indexing that page, it'll still show the URL in the results if it can gather from other variables that it might be worth looking at.</p><p>If my explanation above doesn't make sense, have a look at Matt Cutt's video explanation:<br
/><p><a
href="http://yoast.com/prevent-site-being-indexed/"><em>Click here to view the embedded video.</em></a></p></p><p>So, if you want to effectively hide pages from the search engines, and this might seem contradictory, you <em>need</em> them to index those pages. Why? Because when they index those pages, you can tell them not to List them. There's two ways of doing that: by using robots meta tags, like this (and I've got an article on <a
href="http://yoast.com/articles/robots-meta-tags/">robots meta tags</a> that's more extensive):</p><pre class="brush: xml; light: true; title: ; notranslate">&lt;meta name=&quot;robots&quot; content=&quot;noindex,nofollow&quot;/&gt;</pre><p>The issue with a tag like that is that you have to add it to each and every page. That's why the search engines came up with the <a
href="http://yoast.com/x-robots-tag-play/">X-Robots-Tag HTTP header</a>. This allows you to specify an HTTP header called <code>X-Robots-Tag</code>, and set the value as you would the meta robots tags value. The cool thing about this is that you can do it for an entire site. So, if your site is running on Apache, and mod_headers is enabled (it usually is), you could add the following single line to your <em>.htaccess</em> file:</p><pre class="brush: plain; light: true; title: ; notranslate">Header set X-Robots-Tag &quot;noindex, nofollow&quot;</pre><p>And it'd have the effect that that entire site <em>can</em> be indexed, but will never be shown in the search results. So, get rid of that robots.txt file with <code>Disallow: /</code> in it, and use the X-Robots-Tag instead!</p><p><a
href="http://yoast.com/prevent-site-being-indexed/">Preventing your site from being indexed, the right way</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/prevent-site-being-indexed/feed/</wfw:commentRss> <slash:comments>36</slash:comments> <media:content url="http://www.youtube-nocookie.com/v/KBdEwpRQRD0" duration="274"> <media:player url="http://www.youtube-nocookie.com/v/KBdEwpRQRD0" /> <media:title type="html">Preventing your site from being indexed, the right way &#8226; Yoast</media:title> <media:description type="html">It keeps amazing me that I keep seeing people use robots.txt files to prevent sites from being indexed and thus showing up in the search engines. You know why it keeps amazing me? Because robots.txt doesn&#039;t actually do the latter, even though it does prevent your site from being indexed. Let&#039;s go th</media:description> <media:thumbnail url="http://cdn.yoast.com/wp-content/uploads/2012/01/preventing-your-site-from-being-indexed-the-right-way-8226-yoast-300x225.jpg" /> <media:keywords>Apache,robots.txt</media:keywords> </media:content> </item> <item><title>Magento performance hosting</title><link>http://yoast.com/magento-performance-hosting/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-performance-hosting</link> <comments>http://yoast.com/magento-performance-hosting/#comments</comments> <pubDate>Fri, 12 Jun 2009 07:40:54 +0000</pubDate> <dc:creator>Joachim Houtman</dc:creator> <category><![CDATA[Magento]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[Hosting]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Site Speed]]></category><guid
isPermaLink="false">http://yoast.com/?p=1489</guid> <description><![CDATA[<p>The system requirements of Magento are quite extensive, it requires at least PHP 5.2.0 extended with mcrypt, PDO_MySql and simplexml. For the database Magento needs at least MySQL 4.1.20 with InnoDB storage engine. At MagentoCommerce.com you can find a complete list of requirements. But how do you know if your server meets these system requirements? [...]</p><p><a
href="http://yoast.com/magento-performance-hosting/">Magento performance hosting</a> is a post by <a
rel="author" href="http://yoast.com/author/joachim/">Joachim Houtman</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>The system requirements of Magento are quite extensive, it requires at least PHP 5.2.0 extended with mcrypt, PDO_MySql and simplexml. For the database Magento needs at least MySQL 4.1.20 with InnoDB storage engine. At <a
href="http://www.magentocommerce.com/system-requirements">MagentoCommerce.com</a> you can find a complete list of requirements. But how do you know if your server meets these system requirements? <a
href="http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento">Check this</a> and follow these three steps.</p><h2>How to get the most out your Magento install?</h2><p>Magento is notorious for it speed and performance. But isn't necessary to have a killer web server to get very reasonable performance, it is all about the configuration of your server and the code of your template. However, after the 1.3 release there are some performance improvements, like <a
href="http://www.magentocommerce.com/blog/comments/magento-version-130-is-now-available/">Frontend Flat Catalog</a>, and people measure reduction of loading times up to 40%. Another recent development is the <a
href="http://www.magentocommerce.com/extension/1359/magento-compiler">Magento Compiler this module</a> compiles all Magento files. From tests this module gave between 25% to 50% better performance. This module is still in beta and should not be used in a production environment for now.</p><p>The question is, what else can you do to speed up your Magento install?</p><h4>Optimize your template for speed</h4><p>More information can be found at the <a
href="http://yoast.com/articles/magento-seo/#speed">Magento SEO</a> article.</p><h4>Enable compression of your files</h4><p>Mod_deflate allows output from your server to be compressed. To enable it for Magento edit your .htaccess, around line 74, in Magento root directory.</p><pre class="brush: plain; title: ; notranslate">&lt;ifmodule mod_deflate.c&gt;
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter
SetOutputFilter DEFLATE
# 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
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
&lt;/ifmodule&gt;</pre><h4>Apache Module mod_expires</h4><p>mod_expires controls the setting of the Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses. To enable Expires HTTP header for Magento you had to change the code underat your .htaccess to.</p><pre class="brush: plain; title: ; notranslate">&lt;ifmodule mod_expires.c&gt;
ExpiresActive On
ExpiresDefault &quot;access plus 1 month&quot;
&lt;/ifmodule&gt;</pre><h4>Use PHP Accelerator</h4><p>Install a PHP opcode cacher such as <a
href="http://www.magentocommerce.com/boards/viewthread/9882/">APC</a> or <a
href="http://xcache.lighttpd.net/">XCache</a>. This seems to deliver rather large improvement in the responsive of the Magento install. Some people note a reduce of loading time up to 70%.</p><h4>Tune your MySQL configuration</h4><p>You can modify the configuration of the MySQL server to take advantage of the server's RAM. The efficiency of this step are different, it seems to depends mainly on the number of products. When you have only 100 products, difference will be hardly to notice (below 100ms). But for shops with over 50.000 products there is a huge reduction of the loading time. To give an idea about the settings, for shops with only a limit number of products a query_cache_limit of 1MB will be enough. For larger stores the optimal query cache value can be 64MB. To get the optimal value you really need some testing. A good start point for your <a
href="http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html">Query Cache configuration</a> can be found here.</p><h4>Speed up your Cache files</h4><p>Magento makes extensive use of file-based storage for caching and session storage. The slowest component in a server is the hard drive, so if you use a memory-based file system such as tmpfs, you can save all those extra disk IO cycles by storing these temporary files in memory instead of storing them on your slow hard drive.</p><h5>Let´s do this with tmpfs</h5><p>Let's say your Magento install is at <code>/var/www/domain.com/</code> so your cache and session directories are <code>/var/www/domain.com/var/cache/</code> and <code>/var/www/domain.com/var/session/</code> For cache we will allocate a max of 256MB RAM and for sessions 64MB RAM. It is important to give access to everyone (e.g your webserver Apache)</p><pre class="brush: plain; title: ; notranslate">mount -t tmpfs -o size=256M,mode=0744 tmpfs /var/www/domain.com/var/cache/
mount -t tmpfs -o size=64M,mode=0744 tmpfs /var/www/domain.com/var/session/</pre><p>Now it might be a good idea to restore these volumes each time your server boots. Just add the following lines to your <code>/etc/fstab</code>:</p><pre class="brush: plain; title: ; notranslate">tmpfs /var/www/domain.com/var/cache/ tmpfs size=256,mode=0744 0 0
tmpfs /var/www/domain.com/var/session/ tmpfs size=64,mode=0744 0 0</pre><p>Please note, your tmpfs is temporary in the sense that nothing will be created on your hard drive. If you reboot, everything in tmpfs will be lost.</p><h5>Save the sessions in your database</h5><p>Another option for the sessions is to save them in your database. Magento supports this very well and it is one small step to make this work. Just edit <code>app/etc/local.xml</code>and set</p><pre class="brush: plain; title: ; notranslate">&lt;session_save&gt;&lt;![CDATA[files]]&gt;&lt;/session_save&gt;</pre><p>to</p><pre class="brush: plain; title: ; notranslate">&lt;session_save&gt;&lt;![CDATA[db]]&gt;&lt;/session_save&gt;</pre><p>it will then save all sessions in the database which is a much quicker access than the filesystem. When you use a cluster enviroment you had to use this option.</p><h4>Enable Apache KeepAlives</h4><p>Enable Apache KeepAlives, this allows persistent connections. These long-lived HTTP sessions allow multiple requests to be send over the same TCP connection, this can result in an almost 50% speedup in latency times for HTML documents with lots of images. An example setting can be:</p><pre class="brush: plain; title: ; notranslate">KeepAlive On
KeepAliveTimeout 2</pre><h3>Need more Magento Performance?</h3><p>Ok, you are a very successful online retailer and it is time to cluster, no problem. This means that one single-server doesn't have enough power to keep your customers happy and so you need a clustered environment with two or more servers. A first step can be to start using a Content Delivery Network (CDN).</p><p>The most easy to start is using an separate media server, e.g. media.domain.com. Magento has native support for this. You can configure 'Base Media URL' secure and unsecure under web configurations. This allow you to serve media form one server without the needs to synchronize any directory. Another option is to start using a Content Delivery Network (CDN) for delivering the static files like images. <a
class="aff clicky_log_outbound" href="http://yoast.com/out/maxcdn/">MaxCDN</a> has some options for Magento that are quite nice.</p><p>Another option is to use more than one database servers this tactic is called "database replication". One database will be the "master" and all others will be called "slaves". The master is the only database that accepts any sort of write-base queries. These write queries are then replicated to any of the slave servers in real-time. A post at the <a
href="http://www.magentocommerce.com/blog/comments/performance-is-key-notes-on-magentos-performance/">Magento blog</a> will get you on the right track.</p><h4>To summarize, 5 quick wins</h4><ul><li>move the the rules in the .htaccess files from the directories to <a
href="http://www.magentocommerce.com/boards/viewthread/36225/P0/#i9/">virtualhost configuration directives</a></li><li>install Xcache or APC PHP cache accelerator</li><li>clean up your template and layout</li><li>make sure Apache KeepAlives is enabled</li><li>use a memory-based file system for Magento's <code>var/cache/</code> and <code>var/session/</code> directory</li></ul><h3>Conclusion</h3><p>This article give a introduction how to improve your Magento site performance, none of these tips are revolutionary. Because every website's scenario is different, when you really want to get the most out of your Magento install you need to hire a professional. The only way to discover the optimal server configuration is testing, a really great tool to use is <a
href="http://browsermob.com/load-testing">Browsermob</a>, load testing with real web browsers so you will able to put even the Magento checkout process under load testing.</p><p>Now, all of the above you can’t do on your average host, you need a VPS that provides you full control of your server environment. Check out WestHost’s sister company, <a
href="http://yoast.com/out/vpsnet">VPS.net</a>, for a VPS environment that would give you full control.</p><p><a
href="http://yoast.com/magento-performance-hosting/">Magento performance hosting</a> is a post by <a
rel="author" href="http://yoast.com/author/joachim/">Joachim Houtman</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/magento-performance-hosting/feed/</wfw:commentRss> <slash:comments>39</slash:comments> </item> <item><title>Playing with the X-Robots-Tag HTTP header</title><link>http://yoast.com/x-robots-tag-play/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=x-robots-tag-play</link> <comments>http://yoast.com/x-robots-tag-play/#comments</comments> <pubDate>Sun, 20 Jan 2008 20:41:57 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[SEO]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[Microformats]]></category> <category><![CDATA[robots.txt]]></category> <category><![CDATA[SEO tools]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/x-robots-tag-play/</guid> <description><![CDATA[<p>Ever since the announcement on the Google Blog and more recently Yahoo's announcement that they've enhanced their support for it, I've been meaning to play with the X-Robots-Tag header. This HTTP header allows you to do what you'd normally do in a robots meta tag, in an HTTP header, which has some pretty cool appliances. [...]</p><p><a
href="http://yoast.com/x-robots-tag-play/">Playing with the X-Robots-Tag HTTP header</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>Ever since the <a
href="http://googleblog.blogspot.com/2007/07/robots-exclusion-protocol-now-with-even.html">announcement on the Google Blog</a> and more recently Yahoo's announcement that they've <a
href="http://www.seroundtable.com/archives/015636.html">enhanced their support for it</a>, I've been meaning to play with the X-Robots-Tag header. This HTTP header allows you to do what you'd normally do in a <a
href="http://yoast.com/wordpress/meta-robots-wordpress-plugin/robots-meta-tags/">robots meta tag</a>, in an HTTP header, which has some pretty cool appliances. I'll show you a few cool things you can do with this, but first some theory. If you don't feel like that, skip to the <a
href="http://yoast.com/x-robots-tag-play/#examples">example uses of the X-Robots-Tag</a>.</p><p>As Sebastian explained in <a
href="http://www.seomoz.org/blog/robots-exclusion-protocol-101" title="Robots Exclusion Protocol 101">an excellent post on SEOmoz</a>, there are two different kinds of directives: crawler directives and indexer directives.</p><p><span
id="more-520"></span><br
/> <strong>Crawler directives</strong><br
/> The <code>robots.txt</code> file only contains the so called Crawler directives, telling search engines, identified by their <code>User-agent:</code>, where they are not allowed to go by using <code>Disallow:</code> and where they <em>can</em> (and should) go by using <code>Allow:</code>, and by pointing them at a <code>Sitemap:</code>.</p><p>As Sebastian pointed out and explains thoroughly in <a
href="http://sebastians-pamphlets.com/standardization-of-rep-tags-as-robots-txt-directives/">another brilliant post</a>, pages that search engines aren't allowed to spider, can still show up in the search results, when they have enough links pointing at them. This basically means that if you want to <em>really</em> <a
href="http://www.seomoz.org/blog/12-ways-to-keep-your-content-hidden-from-the-search-engines">hide something from the search engines</a> and thus from people using search, <code>robots.txt</code> just isn't good enough.</p><p><strong>Indexer directives</strong><br
/> Indexer directives are directives that are, even with the birth of the X-Robots-Tag, set on a per page or even per element basis. Up until July 2007, there were two: the microformat <a
href="http://microformats.org/wiki/rel-nofollow">rel="nofollow"</a>, which means that that link should not pass authority / PageRank, and the <a
href="http://yoast.com/wordpress/meta-robots-wordpress-plugin/robots-meta-tags/">Meta Robots tag</a>.</p><p>With the Meta Robots tag, you can <em>really</em> prevent search engines from showing the pages you block in the search results. You can reach the same with the relatively new X-Robots-Tag HTTP header. If you don't know what an HTTP header is, I'd suggest reading the <a
href="http://en.wikipedia.org/wiki/HTTP">Wikipedia page on it</a>, but in short: look at it as the envelope around your content. This HTTP header is better than the meta robots tag for a couple of reasons, one of them is that you can send those headers for other documents too. So, let's get into some examples.</p><h2><a
title="examples" name="examples"></a>Example uses of the X-Robots-Tag</h2><p>If you want to prevent search engines from showing files you've generated with PHP, add the following in the header file:</p><pre class="brush: plain; title: ; notranslate">header(&quot;X-Robots-Tag: noindex&quot;, true);</pre><p>This would not prevent search engines from following the links on those pages, if you want to do that, do the following:</p><pre class="brush: plain; title: ; notranslate">header(&quot;X-Robots-Tag: noindex, nofollow&quot;, true);</pre><p>But doing it in PHP is probably not the easiest use for this kind of thing. I myself greatly prefer setting headers in Apache, when possible. Consider, for instance, preventing search engines from caching / showing a preview for all .doc files on your domain, you would only have to do the following:</p><pre class="brush: plain; title: ; notranslate">&amp;lt;FilesMatch &quot;\.doc$&quot;&amp;gt;
Header set X-Robots-Tag &quot;index, noarchive, nosnippet&quot;
&amp;lt;/Files&amp;gt;</pre><p>Or, if you'd want to do this for both .doc and .pdf files:</p><pre class="brush: plain; title: ; notranslate">&amp;lt;FilesMatch &quot;\.(doc|pdf)$&quot;&amp;gt;
Header set X-Robots-Tag &quot;index, noarchive, nosnippet&quot;
&amp;lt;/Files&amp;gt;</pre><p>Or another case, your <code>robots.txt</code> file itself is <a
href="http://www.google.com/search?hl=en&amp;q=allinurl%3A%22%2Frobots.txt%22" rel="nofollow">showing up in the search results</a>. Adding this to your Apache config or your <code>.htaccess</code> file would solve that:</p><pre class="brush: plain; title: ; notranslate">&amp;lt;FilesMatch &quot;robots\.txt&quot;&amp;gt;
Header set X-Robots-Tag &quot;noindex&quot;
&amp;lt;/FilesMatch&amp;gt;</pre><p>I had a slight uncomfortable feeling when writing this down, so I e-mailed <a
href="http://www.mattcutts.com/blog/">Matt Cutts</a> asking the following: "&lt;snip&gt; would that mean that you will still fetch it for robots.txt purposes, but won't show it in the index?". I'm waiting for him to answer, and will add his response here once I have it.</p><p><strong>Tools</strong><br
/> I've quickly created a <a
href="javascript:(function(){function%20read(url){var%20r=new%20XMLHttpRequest();r.open('HEAD',url,false);r.send(null);return%20r.getAllResponseHeaders();}alert(read(window.location))})();">bookmarklet</a> which shows all the headers for a page (works in Moz browsers only I think, and a <a
href="http://cdn.yoast.com/wp-content/uploads/2008/01/headerdetector.user.js" target="_blank" title="X-Robots-Tag HeaderDetector">Greasemonkey script</a> which pops up when a page is using an X-Robots-Tag header.</p><p><strong>Conclusion</strong><br
/> As you can see, if you combine the examples above with the stuff you can learn from for instance <a
href="http://www.askapache.com/htaccess/using-filesmatch-and-files-in-htaccess.html">AskApache's .htaccess tutorial</a>, the X-Robots-Tag HTTP header becomes a very powerful tool. Use it wisely and with caution, as you won't be the first to block your entire site by accident, but it's a great addition to your toolset if you know how to use it.</p><p><a
href="http://yoast.com/x-robots-tag-play/">Playing with the X-Robots-Tag HTTP header</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/x-robots-tag-play/feed/</wfw:commentRss> <slash:comments>31</slash:comments> </item> <item><title>How to remove www from your URL with mod_rewrite</title><link>http://yoast.com/how-to-remove-www-from-your-url-with-mod_rewrite/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-remove-www-from-your-url-with-mod_rewrite</link> <comments>http://yoast.com/how-to-remove-www-from-your-url-with-mod_rewrite/#comments</comments> <pubDate>Sun, 08 Apr 2007 20:56:17 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[SEO]]></category> <category><![CDATA[Serverside]]></category> <category><![CDATA[Apache]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/how-to-remove-www-from-your-url-with-mod_rewrite/</guid> <description><![CDATA[<p>I got a hit today for the following search query: how do you get rid of the www in url. As you can see that hits on my article about removing PHPSESSID's, which isn't quite what the person was looking for I guess. Here's the code to 301 redirect the www version of your site [...]</p><p><a
href="http://yoast.com/how-to-remove-www-from-your-url-with-mod_rewrite/">How to remove www from your URL with mod_rewrite</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>I got a hit today for the following search query: <a
href="http://www.google.com/search?q=how+do+you+get+rid+of+the+www+in+url&amp;start=0">how do you get rid of the www in url</a>. As you can see that hits on my article about <a
href="http://yoast.com/how-to-get-rid-of-phpsessid-in-the-url-and-redirect/">removing PHPSESSID's</a>, which isn't quite what the person was looking for I guess. Here's the code to 301 redirect the www version of your site to the non-www version using Apache's mod_rewrite:</p><pre class="brush: plain; title: ; notranslate">RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]</pre><h2>Adding the www instead of removing it</h2><p>And, as requested in the comments, the code to <strong>add www</strong> to your domain name:</p><pre class="brush: plain; title: ; notranslate">RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com$1 [R=301]</pre><p><a
href="http://yoast.com/how-to-remove-www-from-your-url-with-mod_rewrite/">How to remove www from your URL with mod_rewrite</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/how-to-remove-www-from-your-url-with-mod_rewrite/feed/</wfw:commentRss> <slash:comments>42</slash:comments> </item> <item><title>PHP 301 redirects for Apache and IIS</title><link>http://yoast.com/php-301-redirects-apache-iis/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-301-redirects-apache-iis</link> <comments>http://yoast.com/php-301-redirects-apache-iis/#comments</comments> <pubDate>Mon, 02 Apr 2007 20:32:04 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Serverside]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/php-301-redirects-for-apache-and-iis/</guid> <description><![CDATA[<p>This one is just here for my own reference, because the default 302 status code just isn't good enough! PHP 301 for Apache: PHP 301 for IIS:</p><p><a
href="http://yoast.com/php-301-redirects-apache-iis/">PHP 301 redirects for Apache and IIS</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>This one is just here for my own reference, because the default 302 status code just isn't good enough!</p><p>PHP 301 for Apache:</p><pre class="brush: php; title: ; notranslate">header(&quot;HTTP/1.1 301 Moved Permanently&quot;);
header(&quot;Location: http://www.example.com/newpage/&quot;);
exit;</pre><p>PHP 301 for IIS:</p><pre class="brush: php; title: ; notranslate">header(&quot;Status: 301 Moved Permanently&quot;);
header(&quot;Location: http://www.example.com/newpage/&quot;);
exit;</pre><p><a
href="http://yoast.com/php-301-redirects-apache-iis/">PHP 301 redirects for Apache and IIS</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/php-301-redirects-apache-iis/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Convert underscores to dashes with Apache mod_rewrite</title><link>http://yoast.com/apache-rewrite-dash-underscore/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apache-rewrite-dash-underscore</link> <comments>http://yoast.com/apache-rewrite-dash-underscore/#comments</comments> <pubDate>Sun, 25 Mar 2007 15:32:28 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Serverside]]></category> <category><![CDATA[Apache]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/apache-rewrite-dash-underscore/</guid> <description><![CDATA[<p>Update: (Aug 4 2007) the stuff below is no longer necessary, all major search engines now treat underscores and dashes exactly the same, as word separators! A year or so back, I was using underscores in my URL's on this site for spaces, and I decided to switch them to dashes, since several people, including [...]</p><p><a
href="http://yoast.com/apache-rewrite-dash-underscore/">Convert underscores to dashes with Apache mod_rewrite</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><strong>Update:</strong> (Aug 4 2007) the stuff below is no longer necessary, all major search engines now treat underscores and dashes exactly the same, as word separators!</p><p>A year or so back, I was using underscores in my URL's on this site for spaces,  and I decided to switch them to dashes, since several people, including Matt Cutts, had blogged that this was "the way to go". Now at that time I just redirected all old URL's to new ones, which created like 30 lines in my Apache config, something I didn't really like...</p><p>This morning I took the time to find a more elegant solution, and the easiest one I could come up with is the following:</p><pre class="brush: plain; title: ; notranslate">RewriteCond %{REQUEST_URI} ^(.*)_(.*)/$
RewriteRule (.*)_(.*)/ http://yoast.com$1-$2/ [R=301]</pre><p>This will rewrite a single underscore to a single dash, using a 301 redirect. So if you have directories with four underscores, it will go through this rewrite four  times before reaching the final URL. I had some directories in which this was the case, and made sure it only had to redirect a maximum of two times by adding the following lines above it:</p><pre class="brush: plain; title: ; notranslate">RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)/ http://yoast.com$1-$2-$3/ [R=301]</pre><p>You could add even more lines like these if need be, I'd make sure that no more than two redirects are needed to rewrite the underscores into dashes.</p><p>The "/" on the end of the RewriteCond is there to make sure this is a directory, and not a file, since I've got quite a few images with underscores in the names and didn't want to bother renaming them.</p><p><a
href="http://yoast.com/apache-rewrite-dash-underscore/">Convert underscores to dashes with Apache mod_rewrite</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/apache-rewrite-dash-underscore/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Trailing double forward slashes in URL&#8217;s in the SERPs&#8230;</title><link>http://yoast.com/trailing-double-forward-slashes-in-urls-in-the-serps/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=trailing-double-forward-slashes-in-urls-in-the-serps</link> <comments>http://yoast.com/trailing-double-forward-slashes-in-urls-in-the-serps/#comments</comments> <pubDate>Sat, 17 Mar 2007 19:18:36 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Serverside]]></category> <category><![CDATA[Apache]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/trailing-double-forward-slashes-in-urls-in-the-serps/</guid> <description><![CDATA[<p>This query gives a result I hadn't seen before (image), the same page was indexed with both a single trailing forward slash, which is of course normal, and with a double trailing forward slash... This is of course a duplicate content issue, especially when people link to the double slash one by accident. The fix [...]</p><p><a
href="http://yoast.com/trailing-double-forward-slashes-in-urls-in-the-serps/">Trailing double forward slashes in URL&#8217;s in the SERPs&#8230;</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p><a
href="http://www.google.com/search?q=site:http://yoast.com/code/greasemonkey/statistics-detector/&amp;hl=en&amp;safe=off&amp;filter=0" target="_blank">This query</a> gives a result I hadn't seen before (<a
href="http://cdn2.yoast.com/wp-content/uploads/2007/03/doubleslash.png" title="double trailing forward slash in Google SERPs">image</a>), the same page was indexed with both a single trailing forward slash, which is of course normal, and with a double trailing forward slash... This is of course a duplicate content issue, especially when people link to the double slash one by accident. The fix for it in Apache is quite easy, just add this to your server config or htaccess:</p><pre class="brush: plain; title: ; notranslate">RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)//$
RewriteRule . http://yoast.com%1/ [R=301]</pre><p><a
href="http://yoast.com/trailing-double-forward-slashes-in-urls-in-the-serps/">Trailing double forward slashes in URL&#8217;s in the SERPs&#8230;</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/trailing-double-forward-slashes-in-urls-in-the-serps/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Changing your WordPress date permalink structure</title><link>http://yoast.com/changing-your-permalink-structure/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=changing-your-permalink-structure</link> <comments>http://yoast.com/changing-your-permalink-structure/#comments</comments> <pubDate>Tue, 03 Oct 2006 14:16:17 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Apache]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/changing-your-permalink-structure/</guid> <description><![CDATA[<p>I recently changed the permalink structure of this WordPress blog, going from /%year%/%monthnum%/%day%/%postname%/ (WordPress default i think) to the much more elegant and simple /%postname%/. This is very cool ofcourse, both because it's simpler and SEO wise, but on an existing blog, this leaves you with lots of links that point to the wrong URL. [...]</p><p><a
href="http://yoast.com/changing-your-permalink-structure/">Changing your WordPress date permalink structure</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>I recently changed the permalink structure of this WordPress blog, going from <code>/%year%/%monthnum%/%day%/%postname%/</code> (WordPress default i think) to the much more elegant and simple <code>/%postname%/</code>. This is very cool ofcourse, both because it's simpler and SEO wise, but on an existing blog, this leaves you with lots of links that point to the wrong URL. If you're running your blog on Apache, the solution is quite simple, if you can tweak your <code>.htaccess</code> file or your Apache config.</p><p>The solution can be found in one single RedirectMatch line. This line should be placed above the WordPress code, or in the Apache config. The line is the following:</p><pre class="brush: plain; title: ; notranslate">RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ 

http://www.example.com/$4</pre><p>This matches every URL which starts with  a date, and permanently redirects it to the new URL for this post. Ofcourse you could be running your blog in a subdirectory, like I am, in that case, the line would be:</p><pre class="brush: plain; title: ; notranslate">RedirectMatch 301 /subdir/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$

http://www.example.com/subdir/$4</pre><p>This way, all your incoming links will still work, and thus count for SearchEngines <em>and</em> you have the benefits of the new URL structure.</p><p><a
href="http://yoast.com/changing-your-permalink-structure/">Changing your WordPress date permalink structure</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/changing-your-permalink-structure/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Apache.Startkabel.nl</title><link>http://yoast.com/apachestartkabelnl/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apachestartkabelnl</link> <comments>http://yoast.com/apachestartkabelnl/#comments</comments> <pubDate>Wed, 05 Apr 2006 06:51:25 +0000</pubDate> <dc:creator>Joost de Valk</dc:creator> <category><![CDATA[Offtopic]]></category> <category><![CDATA[Apache]]></category><guid
isPermaLink="false">http://www.joostdevalk.nl/blog/2006/04/05/apachestartkabelnl/</guid> <description><![CDATA[<p>Starting yesterday, i'm the maintainer of apache.startkabel.nl! Since i'll be trying to really make this directory a lot bigger, i'd like to hear all your interesting links, blogs, etc. So: leave them in the comments or email me!</p><p><a
href="http://yoast.com/apachestartkabelnl/">Apache.Startkabel.nl</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></description> <content:encoded><![CDATA[<p>Starting yesterday, i'm the maintainer of <a
title="Apache Startkabel, all your apache links" target="_blank" href="http://apache.startkabel.nl">apache.startkabel.nl</a>! Since i'll be trying to really make this directory a lot bigger, i'd like to hear all your interesting links, blogs, etc. So: leave them in the comments or email me!</p><p><a
href="http://yoast.com/apachestartkabelnl/">Apache.Startkabel.nl</a> is a post by <a
rel="author" href="http://yoast.com/author/joost/">Joost de Valk</a> on <a
href="http://yoast.com">Yoast - Tweaking Websites</a>.A good WordPress blog needs good hosting, you don't want your blog to be slow, or, even worse, down, do you? Check out my thoughts on <a
href="http://yoast.com/wordpress-hosting/">WordPress hosting</a>!</p>]]></content:encoded> <wfw:commentRss>http://yoast.com/apachestartkabelnl/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 4/9 queries in 0.001 seconds using apc
Object Caching 1790/1793 objects using apc
Content Delivery Network via cdn.yoast.com

Served from: yoast.com @ 2012-05-23 09:51:10 -->
