<?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>FaraJoomla Web Design and Development &#187; .htaccess</title>
	<atom:link href="http://www.farajoomla.com/category/blog/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.farajoomla.com</link>
	<description>FaraJoomla Web Design and Development</description>
	<lastBuildDate>Sat, 29 Oct 2011 17:49:38 +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>Redirecting with .htaccess</title>
		<link>http://www.farajoomla.com/2010/05/redirecting-with-htaccess/</link>
		<comments>http://www.farajoomla.com/2010/05/redirecting-with-htaccess/#comments</comments>
		<pubDate>Wed, 12 May 2010 00:31:59 +0000</pubDate>
		<dc:creator>Faramarz</dc:creator>
				<category><![CDATA[.htaccess]]></category>

		<guid isPermaLink="false">http://www.farajoomla.com/?p=282</guid>
		<description><![CDATA[Using the following .htaccess code, you can redirect your users to another destination. In this example we are redirecting the visitors to a &#34;Under Construction&#34; page (construction.php). Make sure you upload your .htaccess files in ascii mode, sending it up as binary will break it and usually make your server unhappy and don&#8217;t forget that [...]]]></description>
			<content:encoded><![CDATA[<p>Using the following .htaccess code, you can redirect your users to another destination. In this example we are redirecting the visitors to a &quot;Under Construction&quot; page (construction.php).</p>
<p>Make sure you upload your .htaccess files in ascii mode, sending it up as binary will break it and usually make your server unhappy and don&#8217;t forget that .htaccess does not work if you&#8217;re on a windows server. Also, make sure to change &#8220;domain.com&#8221; in this example with your own website URL and you&#8217;ll be all set.</p>
<p>The code below blocks all visitors from accessing any page besides the &quot;construction.php&quot; page.</p>
<pre class="brush: text">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/construction\.php$
RewriteRule ^(.*)$ http://domain.com/construction.php[R=307,L]
</pre>
<p>The below code sends all users to construction.php except those with the specified IP. If you need to test your website while others were locked out, then you can use the below code with your IP address. When you are done with maintaining your website you can just remove the .htaccess code and the site will be back up again immediately!</p>
<pre class="brush: text">
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111
RewriteCond %{REQUEST_URI} !^/construction\.php$
RewriteRule ^(.*)$ http://domain.com/construction.php [R=307,L]
</pre>
<p>By the way, you can use this website to figure out what your IP address is: <a href="http://www.ipchicken.com/" target="_blank">http://www.ipchicken.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.farajoomla.com/2010/05/redirecting-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess Overview</title>
		<link>http://www.farajoomla.com/2010/05/htaccess-overview/</link>
		<comments>http://www.farajoomla.com/2010/05/htaccess-overview/#comments</comments>
		<pubDate>Tue, 04 May 2010 14:13:58 +0000</pubDate>
		<dc:creator>Faramarz</dc:creator>
				<category><![CDATA[.htaccess]]></category>

		<guid isPermaLink="false">http://www.farajoomla.com/?p=211</guid>
		<description><![CDATA[What is .htaccess? .htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn &#8216;loaded via the Apache Web Server&#8217;, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files [...]]]></description>
			<content:encoded><![CDATA[<h2>What is .htaccess?</h2>
<p>.htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn &#8216;loaded via the Apache Web Server&#8217;, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. </p>
<h2>Things you can do with .htaccess</h2>
<p>Below are the common uses of .htaccess:
</p>
<p><strong>Error documents</strong></p>
<p>Creating custom error pages is very useful, it allows you to show web site visitors a friendly error message, for instance if a URL on your web site does not work. This avoids the unfriendly &#8217;404 File Not Found&#8217; error and allows you to display a friendly error, explaining possible solutions and guiding the visitor back into your web site content, rather than leaving them frustrated and lost. </p>
<p><strong>Redirects</strong></p>
<p> Redirects enable us to direct web site visitors from one document within your web site to another. This is useful for example, if you have moved your web site content and would like to redirect visitors from old links to the new content location. </p>
<p><strong>Password protection</strong></p>
<p>The password protection and authentication systems offered by the Apache Web Server are probably the most important use of .htaccess files. Very easily, we can password protect a directory (or multiple) of a web site which require a username and password to access. The login procedure for these secure directories is handled automatically by the web browser using a pop-up login interface (you&#8217;ve probably seen these before). Passwords are also encrypted using one of the best encryption methods available which ensures login credentials are kept secure. In this section we will discuss the details of the .htaccess authentication system, we will explain how to set-up password protection, and a variety of helpful related information, we will also explain a variety of pre-made software which can be used to accomplish these tasks. </p>
<p><strong> Deny visitors by IP address</strong></p>
<p>The visitor blocking facilities offered by the Apache Web Server enable us to deny access to specific visitors, or allow access to specific visitors. This is extremely useful for blocking unwanted visitors, or to only allow the web site owner access to certain sections of the web site, such as an administration area. </p>
<p><strong> Deny visitors by referrer</strong></p>
<p>The visitor blocking facilities offered by the Apache Web Server enable us to deny access to specific visitors based on where they have come from. If you&#8217;ve ever looked at your logs and noticed a surprising increase in traffic, yet no increases in actual file requests it&#8217;s probably someone pinching content (such as CSS files) or someone attempting to hack your web site (this may simply mean trying to find non public content).</p>
<p>Note, this functionality requires that &#8216;mod_rewrite&#8217; is enabled on your server. Due to the demands that can be placed on system resources, it is unlikely it is enabled so be sure to check with your system administrator or web hosting company. </p>
<p><strong> Hot link prevention</strong></p>
<p>Hot link prevention refers to stopping web sites that are not your own from displaying your files or content, e.g. stopping visitors from other web sites. This is most commonly used to prevent other web sites from displaying your images but it can be used to prevent people using your JavaScript or CSS (cascading style sheet) files. The problem with hot linking is it uses your bandwidth, which in turn costs money, hot linking is often referred to as &#8216;bandwidth theft&#8217;.</p>
<p>Using .htaccess we can prevent other web sites from sourcing your content, and can even display different content in turn. For example, it is common to display what is referred to as an &#8216;angry man&#8217; images instead of the desired images.</p>
<p>Note, this functionality requires that &#8216;mod_rewrite&#8217; is enabled on your server. Due to the demands that can be placed on system resources, it is unlikely it is enabled so be sure to check with your system administrator or web hosting company. </p>
<p><strong> Blocking offline browsers and &#8216;bad bots&#8217;</strong></p>
<p>Offline browsers are   pieces of software which download your web page, following the links to   your other web pages, downloading all the content and images.  The   purpose of this is innocent, so the visitor can log off the Internet and   browse the site without a connection, but the demand on the server and   bandwidth usage can be expensive.  Bad bots as they are often called   refers to programs which visit your web site, either to source content,   look for security holes or to scan for email addresses.  This is often   how your email address ends up on &#8216;Spam&#8217; databases, because they have   set a &#8216;bot&#8217; to scan the Internet and collect email addresses.  These   programs and &#8216;bots&#8217; often ignore the rules set out in &#8216;robot.txt&#8217; files. </p>
<p><strong> DirectoryIndex uses</strong></p>
<p>The directoryindex command allows you to specify a default page to display when a directory is accessed. For instance, if a visitor requests a directory on your web site, you can specify the file to load when the directory is accessed (if a filename is not specified in the initial request). For example, to display a &#8216;index.html&#8217; file rather than showing directory listings or to load a &#8216;index.php&#8217; file rather than an &#8216;index.html&#8217; file. </p>
<p><strong> Adding MIME types</strong></p>
<p>MIME types set what a file is, or rather what file extensions refer to what file types. For example, a &#8216;.html&#8217; file extension refers to a HTML document, a &#8216;.zip&#8217; file extension refers to a ZIP archive file. The server needs to know this so it knows how to deal with the file. This is often used to create custom file extension for common file types. </p>
<p><strong> Enabling SSI (Server Side Includes)</strong></p>
<p>SSI stands for server   side includes, these are special HTML tags which you can include in   your HTML documents to call CGI scripts or other HTML content.  This is   particularly useful, for example to include a navigation menu in your   HTML documents, it allows you to use one document to display the   navigation menu in all your other documents.  This saves disk space and   means if you need to update the content, you only need to modify one   file. </p>
<p><strong> Enabling CGI outside of the cgi-bin</strong></p>
<p>If your web server   does not allow you to run CGI scripts outside of the &#8216;cgi-bin&#8217;   directory, you can enable CGI.  Check with your system administrator or   web hosting company before doing so. </p>
<p><strong> Disable directory listings</strong></p>
<p>Preventing directory   listings can be very useful if for example, you have a directory   containing important &#8216;.zip&#8217; archive files or to prevent viewing of your   image directories.  Alternatively it can also be useful to enable   directory listings if they are not available on your server, for example   if you wish to display directory listings of your important &#8216;.zip&#8217;   files. </p>
<p><strong> Setting server timezone</strong></p>
<p>To set your web   servers date timezone.</p>
<p><strong>Changing server signature</strong></p>
<p>To change the server   signature which is displayed as part of the default Apache error   documents.</p>
<p><strong> Preventing access to your PHP includes</strong></p>
<p>If you have a   directory containing PHP includes, that you do not wish to be accessed   directly from the browser, there is a way of disabling the directory   using Mod_Rewrite. </p>
<p><strong> Prevent access to php.ini</strong></p>
<p>If you run the risk   of someone accessing your php.ini or php.cgi files directly through   their browsers, you can limit access to them using .htaccess. </p>
<p><strong> Forcing scripts to display as source code</strong></p>
<p>If you need to   display scripts as source code, instead of executing, for example to   allow review, this can be achieved with the Remove Handler function.</p>
<p><strong> Ensuring media files are downloaded instead of played</strong></p>
<p>It is possible to   ensure that any media files are treated as a download, rather than to be   played by the browser. </p>
<p><strong> Setting up Associations for Encoded Files</strong></p>
<p>Some browsers are   capable of uncompressing encoded information as they receive it. </p>
<p><strong> Preventing requests with invalid characters </strong></p>
<p>If you wish, you can   use Mod_Rewrite to deny requests containing invalid characters, please   be aware that with certain site setups this may break links. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.farajoomla.com/2010/05/htaccess-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

