<?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>Web development blog &#187; .htaccess</title>
	<atom:link href="http://simplemediacode.info/tag/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://simplemediacode.info</link>
	<description>by Simple Media Code</description>
	<lastBuildDate>Wed, 09 May 2012 12:19:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Cache expiration on static images and content with .htaccess</title>
		<link>http://simplemediacode.info/cache-expiration-on-static-images-and-content-with-htaccess/</link>
		<comments>http://simplemediacode.info/cache-expiration-on-static-images-and-content-with-htaccess/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 20:07:11 +0000</pubDate>
		<dc:creator>umbrovskis</dc:creator>
				<category><![CDATA[Coding web page]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Cache expiration]]></category>
		<category><![CDATA[content cache]]></category>
		<category><![CDATA[ME2J.COM]]></category>
		<category><![CDATA[selfhosted CDN server]]></category>
		<category><![CDATA[web page optimization]]></category>
		<category><![CDATA[webpage speedup]]></category>
		<category><![CDATA[Websites optimization]]></category>

		<guid isPermaLink="false">http://simplemediacode.info/?p=389</guid>
		<description><![CDATA[You can tray this example,which I am using on my content delivery network (CDN) server ME2J.com....]]></description>
			<content:encoded><![CDATA[<p>One of main thing for all web sites is content caching to improve site performance. Here are few examples how You can achieve this. Set this cache expiration example, which I am using on my <em>content delivery network</em> (CDN) server ME2J.com.</p>
<pre class="brush: bash; title: ; notranslate">
&lt;FilesMatch &quot;.(jpg|png|gif)$&quot;&gt;
ExpiresDefault A0
Header set Cache-Control &quot;max-age=0,  no-cache, must-revalidate&quot;
&lt;/FilesMatch&gt;
</pre>
<p>Which mean, that expiration date is in access moment and set headers to 0 values. As You can see, here You can add more filetypes for static content</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-401" style="border: 0pt none" src="http://simplemediacode.info/imagesphotos/htaccess-cache-expiration-code-620x360.jpg" alt=".htaccess cache expiration code" width="620" height="360" /></p>
<p>This example can also speed-up Your webpage just with few lines of code by setting longer expiration time:</p>
<pre class="brush: bash; title: ; notranslate">
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
</pre>
<p>Where A is access time and 2592000=60*60*24*30 or one month.</p>
]]></content:encoded>
			<wfw:commentRss>http://simplemediacode.info/cache-expiration-on-static-images-and-content-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing WWW from URI (or domain) with PHP</title>
		<link>http://simplemediacode.info/removing-www-from-uri-or-domain-with-php/</link>
		<comments>http://simplemediacode.info/removing-www-from-uri-or-domain-with-php/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 13:40:13 +0000</pubDate>
		<dc:creator>umbrovskis</dc:creator>
				<category><![CDATA[Coding web page]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[duplicate content]]></category>
		<category><![CDATA[non-www site]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[www prefix]]></category>

		<guid isPermaLink="false">http://simplemediacode.info/?p=136</guid>
		<description><![CDATA[Few weeks ago I wrote how to remove WWW from domain with .htaccess. In some cases or hosting plans it's not possible to view or use .htaccess file (e.g. some low cost or free hosting providers). Solution is PHP code which redirects all www requests to non www page....]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago I wrote <strong><a title="how to remove WWW from domain with .htaccess" href="http://mediabox.lv/en/remove-www-from-domain-with-htaccess/">how to remove WWW from domain with .htaccess</a></strong>. In some cases or hosting plans it&#8217;s not possible to view or use .htaccess file (e.g. some low cost or free hosting providers).</p>
<p><strong>Solution is PHP code</strong> which redirects all www requests to non www page. Since You are (should) use some general configuration or header file in Your web application, you can include this PHP code (very top of php page):</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php // Removing WWW from URI with PHP http://simplemediacode.info/?p=136
if ('mediabox.lv' !== $_SERVER['HTTP_HOST']) {
header('Location: http://mediabox.lv' . $_SERVER['REQUEST_URI'], null, 301);
}
?&gt;
</pre>
<p>It use build-in <a href="http://php.net/manual/en/function.header.php">PHP header() function</a> to redirect all requests to another page, in this case: non-www domain.</p>
<p>Simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://simplemediacode.info/removing-www-from-uri-or-domain-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove WWW from domain with .htaccess</title>
		<link>http://simplemediacode.info/remove-www-from-domain-with-htaccess/</link>
		<comments>http://simplemediacode.info/remove-www-from-domain-with-htaccess/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 15:47:26 +0000</pubDate>
		<dc:creator>umbrovskis</dc:creator>
				<category><![CDATA[Coding web page]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[duplicate content]]></category>
		<category><![CDATA[non-www site]]></category>
		<category><![CDATA[www prefix]]></category>

		<guid isPermaLink="false">http://simplemediacode.info/?p=103</guid>
		<description><![CDATA[Another good thing about removing double content is to remove or add www prefix to your domain. Remove WWW from domain This is what I now use for all my domains &#8211; domain without www prefix. Add WWW to domain ...]]></description>
			<content:encoded><![CDATA[<p>Another good thing about removing double content is to remove or add <strong>www </strong>prefix to your domain.</p>
<h2>Remove WWW from domain</h2>
<pre class="brush: bash; title: ; notranslate">
# This will remove www from your domain
RewriteCond %{HTTP_HOST} ^www.mediabox.lv$ [NC]
RewriteRule ^(.*)$ http://mediabox.lv/$1 [R=301,L]
</pre>
<p>This is what I now use for all my domains &#8211; <strong>domain without www prefix</strong>.</p>
<h2>Add WWW to domain</h2>
<p>This probably is best for old domains like mine www.rolandinsh.lv</p>
<pre class="brush: bash; title: ; notranslate">
# This will remove www from your domain
RewriteCond %{HTTP_HOST} ^mediabox.lv$ [NC]
RewriteRule ^(.*)$ http://www.mediabox.lv/$1 [R=301,L]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://simplemediacode.info/remove-www-from-domain-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to remove index.html and/or index.php from the URL</title>
		<link>http://simplemediacode.info/remove-index-html-andor-index-php-from-the-url/</link>
		<comments>http://simplemediacode.info/remove-index-html-andor-index-php-from-the-url/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:56:40 +0000</pubDate>
		<dc:creator>umbrovskis</dc:creator>
				<category><![CDATA[Coding web page]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[duplicate content]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[RegExp]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress MU]]></category>
		<category><![CDATA[WPMU]]></category>

		<guid isPermaLink="false">http://simplemediacode.info/?p=8</guid>
		<description><![CDATA[Inspired by my discussion with Kaspars on his homepage konstruktors.com  how to better remove index file. So I'll post both versions, because they use different methods: with and with out RewriteEngine On....]]></description>
			<content:encoded><![CDATA[<p>Inspired by my discussion with Kaspars on his homepage <a title="Konstruktors" href="http://konstruktors.com/blog/web-design/2036-remove-index-html-from-the-url/">konstruktors.com</a> how to better <strong>remove index file</strong>. So I&#8217;ll post both versions, because they use different methods: <span style="text-decoration: underline">with</span> and <span style="text-decoration: underline">with out</span> <strong>RewriteEngine On</strong>.</p>
<p>Here is mine with <strong>RewriteEngine On</strong> (works on this hosting and both versions of GoDaddy hosting plans <em>example1.com</em> and <em>example1.com</em>/<em>example2.com</em>):</p>
<pre class="brush: bash; title: ; notranslate">
# This will remove index.html AND index.php from URL
RewriteCond %{THE_REQUEST} /index.(php|html) HTTP [NC]
RewriteRule (.*)index.(php|html)$ /$1 [R=301,L]
</pre>
<p>And Kaspar&#8217;s method without <strong>RewriteEngine On</strong>:</p>
<pre class="brush: bash; title: ; notranslate">
RewriteEngine On # remove this, if you have it already
RewriteCond %{REQUEST_URI} index.html
RewriteRule ^(.*)index.html$ /$1/ [R=301,L]
</pre>
<p>Purpose of this is to remove <strong>duplicate content</strong> from Internet.</p>
<p>[<strong>Update</strong> on 2010.03.30]</p>
<p>Please keep in mind that some <strong>web applications</strong> still need <strong>index.php</strong> file for <span style="text-decoration: underline">installation scripts</span> as referrers. So it&#8217;s good to keep it in mind and comment these line during installation process if it fails.</p>
<pre class="brush: bash; title: ; notranslate">
# This will remove index.html AND index.php from URL
# RewriteCond %{THE_REQUEST} /index.(php|html) HTTP [NC]
# RewriteRule (.*)index.(php|html)$ /$1 [R=301,L]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://simplemediacode.info/remove-index-html-andor-index-php-from-the-url/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

