<?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:series="http://unfoldingneurons.com/"
><channel><title>David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞. &#187; Apache / Server</title> <atom:link href="http://davidwalsh.name/tutorials/apache-server/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Sun, 20 May 2012 22:40:48 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Create a Virtual Host in&#160;OSX</title><link>http://davidwalsh.name/create-virtual-host</link> <comments>http://davidwalsh.name/create-virtual-host#comments</comments> <pubDate>Mon, 21 Mar 2011 13:59:29 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=5187</guid> <description><![CDATA[As someone who had always developed on PCs, switching over to using Mac OS X was like going from peasant to prince.  Compared to Windows-based machines, Mac&#8217;s OS X operating system is lightyears better.  One OS X feature I make much use of is the integrated Apache server.  Hosting websites on my local machine during development [...]<p><a
href="http://davidwalsh.name/create-virtual-host">Create a Virtual Host in&nbsp;OSX</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>As someone who had always developed on PCs, switching over to using Mac OS X was like going from peasant to prince.  Compared to Windows-based machines, Mac&#8217;s OS X operating system is lightyears better.  One OS X feature I make much use of is the integrated Apache server.  Hosting websites on my local machine during development is a must.  Let me show you how to create multiple websites on your local machine.</p><h2>Step 1:  Create Website&nbsp;Folder</h2><p>User websites appear in the Users/Sites/ directory.  Let&#8217;s create a directory within Sites named &#8220;mynewsite&#8221;:</p><pre class="text">
cd ~/Sites/
mkdir mynewsite
</pre><p>As you&#8217;ll see in a moment, you can add this directory anywhere you&#8217;d like, but for the sake of this post we&#8217;ll add it in the standard Sites directory.</p><h2>Step 2:  Edit <code>httpd-vhosts.conf</code>&nbsp;File</h2><p>The next step is adding a new record to Apache&#8217;s <code>httpd-vhosts.conf</code> file.  My <code>httpd-vhosts.conf</code> file is located within the following directory:  <code>private/etc/apache2/extra/</code>.  This configuration file holds your website virtual host location details.  Let&#8217;s add mynewsite to the configuration:</p><pre class="text">
&lt;VirtualHost *:80&gt;
    DocumentRoot "/Users/myUserName/Sites/mynewsite"
    ServerName mynewsite.local
&lt;/VirtualHost&gt;
</pre><p>The two important configurations are DocumentRoot and ServerName.  DocumentRoot points to the directory we created in step 1.  ServerName refers to the address we want to type into the browser to get to this new site.  I generally create all my hosts with the &#8220;.local&#8221; domain.</p><p>You can also place more specific configurations within this new virtual host, including ProxyPass, directory settings, error documents, redirects, and other settings you sometimes see in .htaccess files:</p><pre class="text">
&lt;VirtualHost *:80&gt;
	DocumentRoot "/Users/myUserName/Sites/mynewsite"
	ServerName mynewsite.local
	&lt;directory "/Users/davidwalsh83/Sites/mynewsite/trunk/"&gt;
		Options Indexes FollowSymLinks
		AllowOverride All
		Order allow,deny
		Allow from all
	&lt;/directory&gt;
	ProxyPass /web-service http://someotherwebsite.com/api/
	ProxyPassReverse /web-service http://someotherwebsite.com/api/
&lt;/VirtualHost&gt;
</pre><p>You can learn more about the possible settings here:  <a
href="http://httpd.apache.org/docs/2.2/vhosts/">http://httpd.apache.org/docs/2.2/vhosts/</a></p><h2>Step 3:  Edit <code>hosts</code>&nbsp;File</h2><p>The <code>hosts</code> file contains a list of host names and IP address to which they match.  We&#8217;ll add another record to this file which points the new website&#8217;s <code>ServerName</code> setting from above (mynewsite.local) to the localhost IP address:</p><pre class="text">
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 
fe80::1%lo0	localhost
127.0.0.1	mynewsite.local
</pre><p>Now mynewsite.local host name is pointing toward your machine.  Coupled with the <code>httpd-vhosts.conf</code> file&#8217;s new settings, the address will find your mynewsites directory!</p><h2>Step 4:  Apache&nbsp;Restart</h2><p>The last step in the process is restarting your Apache install:</p><pre class="text">
apache restart
</pre><p>The other method of quickly restarting Apache is by opening System Settings &gt;&gt; Sharing and unchecking and then checking &#8220;Web Sharing&#8221;.  That&#8217;s all!  Now you can navigate to http://mynewsite.local and see your web files!</p><h2>Quick Side&nbsp;Note</h2><p>Your IT people would probably prefer you not use your machine&#8217;s Apache and instead use a virtual machine for your web development.  I&#8217;ve personally felt the pain of using my MacBook Pro instead of a virtual machine but that was due to MySQL and not Apache.  This tutorial is meant to show you how to quickly get a new site up and running on your local machine.  The same process can be used to create a new virtual host on other machines but the file locations will simply be different.</p><p><a
href="http://davidwalsh.name/create-virtual-host">Create a Virtual Host in&nbsp;OSX</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/create-virtual-host/feed</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>Simple Apache&#160;Proxying</title><link>http://davidwalsh.name/apache-proxy</link> <comments>http://davidwalsh.name/apache-proxy#comments</comments> <pubDate>Wed, 17 Nov 2010 15:19:11 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=5120</guid> <description><![CDATA[I was recently working with Apache and a service running on Kris Zyp&#8217;s Persevere project (which is beyond awesome).  Persevere was pushing messages to my application which was running on Apache; the problem was that Persevere and Apache were running on different ports which technically made them cross-domain.  In order to make the server believe the [...]<p><a
href="http://davidwalsh.name/apache-proxy">Simple Apache&nbsp;Proxying</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>I was recently working with Apache and a service running on <a
href="http://www.persvr.org/Page/Persevere" rel="nofollow">Kris Zyp&#8217;s Persevere</a> project (which is <em>beyond</em> awesome).  Persevere was pushing messages to my application which was running on Apache; the problem was that Persevere and Apache were running on different ports which technically made them cross-domain.  In order to make the server believe the web service was on the same domain/port, I needed to use Apache proxying.  I opened the conf/httpd.conf file and added the following magic to make that possible:</p><pre class="txt">
# Proxy requests to /data to persevere
ProxyPass /service http://localhost:8080/Status
ProxyPassReverse /service/ http://localhost:8080/Status
RewriteRule ^/service$ http://localhost:8080/Status$1 [P,L]
</pre><p>Now any reference to the directory &#8220;/Status&#8221; is proxied to the other port to receive the data!  Apache proxying is a huge boost to your web application <em>if</em> you can trust the other domain/port.</p><p><a
href="http://davidwalsh.name/apache-proxy">Simple Apache&nbsp;Proxying</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/apache-proxy/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Fix WordPress CRONs on Media Temple (dv)&#160;Servers</title><link>http://davidwalsh.name/wordpress-crons</link> <comments>http://davidwalsh.name/wordpress-crons#comments</comments> <pubDate>Thu, 12 Nov 2009 13:40:24 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[Hosting / Domain]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=4125</guid> <description><![CDATA[When I switched from Dreamhost shared hosting to Media Temple (dv) server hosting, I had a hell of a time trying to figure out why CRONs weren&#8217;t working correctly on the website. I had database backups being sent via CRON jobs so making sure CRONs were working was imperative. What&#8217;s great is that the way [...]<p><a
href="http://davidwalsh.name/wordpress-crons">Fix WordPress CRONs on Media Temple (dv)&nbsp;Servers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>When I switched from Dreamhost shared hosting to Media Temple (dv) server hosting, I had a hell of a time trying to figure out why CRONs weren&#8217;t working correctly on the website.  I had database backups being sent via CRON jobs so making sure CRONs were working was imperative.  What&#8217;s great is that the way to make these WordPress CRONs work was by&#8230;setting up a CRON.</p><p> To get things working, you should:</p><ol><li>Log into your Media Temple (dv) control panel.</li><li>Navigate to the domain and click the &#8220;Crontab&#8221; icon.</li><li>Click &#8220;Schedule a Task&#8221;</li><li>Configure the time and frequency of the CRON to any way you&#8217;d like.</li><li><strong>Set the &#8220;command&#8221; value to:</strong><pre class="shell">wget http://12.23.56.78/wp-cron.php</pre></li><li>Replace the fake IP in the command above with the IP address of your website.</li></ol><p>That&#8217;s all!  Hitting the <span
class="file">wp-cron.php</span> file with the CRON will ensure you database backups and other scheduled tasks will run at proper intervals!</p><p><a
href="http://davidwalsh.name/wordpress-crons">Fix WordPress CRONs on Media Temple (dv)&nbsp;Servers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/wordpress-crons/feed</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>Fixing mod_rewrite and .htaccess on GoDaddy&#160;Hosting</title><link>http://davidwalsh.name/mod_rewrite-htaccess-godaddy</link> <comments>http://davidwalsh.name/mod_rewrite-htaccess-godaddy#comments</comments> <pubDate>Thu, 05 Nov 2009 13:24:52 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[.htaccess]]></category> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[Hosting / Domain]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=4119</guid> <description><![CDATA[I recently launched a new website on GoDaddy shared hosting. The website required mod_rewrite for SEO-friendly URLs. GoDaddy provides mod_rewrite but every time I tried to hit a two-deep URL, I would get a 404 error. Here&#8217;s what I had: # Mod Rewrite Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d [...]<p><a
href="http://davidwalsh.name/mod_rewrite-htaccess-godaddy">Fixing mod_rewrite and .htaccess on GoDaddy&nbsp;Hosting</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>I recently launched a new website on GoDaddy shared hosting.  The website required mod_rewrite for SEO-friendly URLs.  GoDaddy provides mod_rewrite but every time I tried to hit a two-deep URL, I would get a 404 error.  Here&#8217;s what I had:</p><pre class="htaccess"># Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</pre><p>The fix to this problem was to add the following directive before my mod_rewrite directives:</p><pre class="htaccess">#Fix Rewrite
Options -Multiviews</pre><p>Tada!  The URLs began working and the website&#8217;s SEO has taken off!</p><p><a
href="http://davidwalsh.name/mod_rewrite-htaccess-godaddy">Fixing mod_rewrite and .htaccess on GoDaddy&nbsp;Hosting</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/mod_rewrite-htaccess-godaddy/feed</wfw:commentRss> <slash:comments>38</slash:comments> </item> <item><title>Use FURL to Retrieve Website&#160;Headers</title><link>http://davidwalsh.name/furl-retrieve-website-headers</link> <comments>http://davidwalsh.name/furl-retrieve-website-headers#comments</comments> <pubDate>Fri, 26 Jun 2009 12:39:26 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[Shell]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=2990</guid> <description><![CDATA[It&#8217;s important to know what headers your website and its files are communicating. For example, if your website is providing a 404 status, you&#8217;re probably streaking toward your computer to fix the problem. Using the FURL library, you may retrieve website headers from the command line. The Shell&#160;Script furl http://davidwalsh.name Simple and quick &#8212; just [...]<p><a
href="http://davidwalsh.name/furl-retrieve-website-headers">Use FURL to Retrieve Website&nbsp;Headers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>It&#8217;s important to know what headers your website and its files are communicating.  For example, if your website is providing a 404 status, you&#8217;re probably streaking toward your computer to fix the problem.  Using the FURL library, you may retrieve website headers from the command line.</p><h2>The Shell&nbsp;Script</h2><pre class="shell">
furl http://davidwalsh.name
</pre><p>Simple and quick &#8212; just like every shell directive.</p><h2>The Sample&nbsp;Response</h2><pre class="shell">
HTTP/1.1 200 OK
Date: Thu, 25 Jun 2009 01:50:50 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.6
X-Pingback: http://davidwalsh.name/xmlrpc.php
Cache-Control: max-age=1, private, must-revalidate
Expires: Thu, 25 Jun 2009 01:50:51 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8
</pre><p>Don&#8217;t have FURL?  Install it by scripting this:</p><pre class="shell">
sudo port install furl
</pre><p>How is this useful?  I would use this to periodically (cron) check my website to make sure it was up.  What would you use this for?</p><p><a
href="http://davidwalsh.name/furl-retrieve-website-headers">Use FURL to Retrieve Website&nbsp;Headers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/furl-retrieve-website-headers/feed</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>XAMPP Lite, Windows Vista, and&#160;php5apache2_2.dll</title><link>http://davidwalsh.name/xampp-lite-windows-vista-php5apache22dll</link> <comments>http://davidwalsh.name/xampp-lite-windows-vista-php5apache22dll#comments</comments> <pubDate>Fri, 22 May 2009 13:06:21 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=2384</guid> <description><![CDATA[I recently ran into a nightmare when needing to use my father&#8217;s laptop for development.  My XAMMP Lite USB install, which worked perfectly on my Windows XP desktop, was giving the following error when trying to start Apache: apache.exe: Syntax error on line 477 of E:/xampplite/apache/conf/httpd.conf: Syntax error on line 7 of E:/xampplite/apache/conf/extra/httpd-xampp.conf: Cannot load [...]<p><a
href="http://davidwalsh.name/xampp-lite-windows-vista-php5apache22dll">XAMPP Lite, Windows Vista, and&nbsp;php5apache2_2.dll</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>I recently ran into a nightmare when needing to use my father&#8217;s laptop for development.  My XAMMP Lite USB install, which worked perfectly on my Windows XP desktop, was giving the following error when trying to start Apache:</p><pre class="bash">
apache.exe: Syntax error on line 477 of E:/xampplite/apache/conf/httpd.conf: 
Syntax error on line 7 of E:/xampplite/apache/conf/extra/httpd-xampp.conf: 
Cannot load E:/xampplite/apache/bin/php5apache2_2.dll into server: The specified module
could not be found.
</pre><p>After 20 minutes of frustration, I finally found the golden solution.  I needed to <a
href="http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71">download</a> and place <span
class="file">msvcr71.dll</span> in my <span
class="file">\xampplite\apache\bin</span> folder.  Apparently it&#8217;s a Microsoft runtime file that Vista doesn&#8217;t have.  Disaster averted!</p><p><a
href="http://davidwalsh.name/xampp-lite-windows-vista-php5apache22dll">XAMPP Lite, Windows Vista, and&nbsp;php5apache2_2.dll</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/xampp-lite-windows-vista-php5apache22dll/feed</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>Set php.ini Values Using&#160;.htaccess</title><link>http://davidwalsh.name/php-values-htaccess</link> <comments>http://davidwalsh.name/php-values-htaccess#comments</comments> <pubDate>Tue, 04 Nov 2008 13:39:31 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=672</guid> <description><![CDATA[Did you know that you can set php.ini values right inside the .htaccess file? It&#8217;s actually very easy. The .htaccess&#160;Code #format php_value setting_name setting_value #example php_value upload_max_filesize 10M Of course you could simply place these in the .htaccess file, but .htaccess is a viable alternative if your host doesn&#8217;t allow you to touch the php.ini [...]<p><a
href="http://davidwalsh.name/php-values-htaccess">Set php.ini Values Using&nbsp;.htaccess</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>Did you know that you can set php.ini values right inside the <span
class="file">.htaccess</span> file?  It&#8217;s actually very easy.</p><h2>The .htaccess&nbsp;Code</h2><pre  class="js">
#format
php_value setting_name setting_value

#example
php_value  upload_max_filesize  10M
</pre><p>Of course you could simply place these in the <span
class="file">.htaccess</span> file, but <span
class="file">.htaccess</span> is a viable alternative if your host doesn&#8217;t allow you to touch the <span
class="file">php.ini</span> file.</p><p><a
href="http://davidwalsh.name/php-values-htaccess">Set php.ini Values Using&nbsp;.htaccess</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/php-values-htaccess/feed</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>Increase PHP&#8217;s File Upload Limit Using&#160;php.ini</title><link>http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini</link> <comments>http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini#comments</comments> <pubDate>Thu, 03 Jul 2008 12:01:19 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://davidwalsh.name/?p=307</guid> <description><![CDATA[The file upload size limit is usually set pretty low by shared hosting providers. Why? To save bandwidth, keep the server moving quickly, and think about it &#8212; how many customers really need a large upload limit? If you do need to increase the maximum upload limit, all you need to do is place the [...]<p><a
href="http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini">Increase PHP&#8217;s File Upload Limit Using&nbsp;php.ini</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>The file upload size limit is usually set pretty low by shared hosting providers.  Why?  To save bandwidth, keep the server moving quickly, and think about it &#8212; how many customers really need a large upload limit?  If you do need to increase the maximum upload limit, all you need to do is place the following code snippet in your <span
class="file">php.ini</span> file:</p><pre  class="js">
file_uploads = On
upload_max_filesize = 10M //needs to be in {x}M format
</pre><p>Note that not all hosting providers allow customers to increase the file upload limit.  Take that into consideration when purchasing your customer&#8217;s web hosting.</p><p><a
href="http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini">Increase PHP&#8217;s File Upload Limit Using&nbsp;php.ini</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/increase-php-file-upload-limit-using-php-ini/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Advanced .htaccess Security &#8211; Allow or Block Specific IPs From Your&#160;Website</title><link>http://davidwalsh.name/htaccess-security-allow-block-ips</link> <comments>http://davidwalsh.name/htaccess-security-allow-block-ips#comments</comments> <pubDate>Fri, 12 Oct 2007 12:27:47 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[.htaccess]]></category> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[Security]]></category><guid
isPermaLink="false">http://davidwalsh.name/advanced-htaccess-security-allow-or-block-specific-ips-from-your-website/</guid> <description><![CDATA[The more I use the .htaccess file the more I appreciate its value. My next valuable lesson in .htaccess security deals with allowing and blocking access to a web server from a specific IP address. Reasons for doing this include: Keeping a known hacker/bot from accessing your website Allowing only your IP address to view [...]<p><a
href="http://davidwalsh.name/htaccess-security-allow-block-ips">Advanced .htaccess Security &#8211; Allow or Block Specific IPs From Your&nbsp;Website</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>The more I use the <span
class="file">.htaccess</span> file the more I appreciate its value.  My next valuable lesson in <span
class="file">.htaccess</span> security deals with allowing and blocking access to a web server from a specific IP address.  Reasons for doing this include:</p><ul><li>Keeping a known hacker/bot from accessing your website</li><li>Allowing only your IP address to view your website (while it&#8217;s in development, for example)</li><li>Allowing only trusted persons into your website (if your users&#8217; IP&#8217;s stay the same, that&#8217;s more secure than user/pass)</li><li>Disallowing persons from a specified country <em>(or any known location)</em> from your website</li><li>Banning persons from your website</li></ul><h2>The&nbsp;Code</h2><p><pre  class="js">&lt;limit GET POST PUT&gt;
order deny,allow
deny from 202.57.377.22
deny from 8.77.88.33
allow from all
&lt;/limit&gt;</pre><p>The above code bans the two IP addresses from accessing the website.</p><p>Chances are you wont do this often.  I do, however, believe that you should use this for your development server.   Allowing only LAN users to access your development server prevents a search engine or hacker from getting to your website:</p><pre  class="js">&lt;limit GET POST PUT&gt;
order deny,allow
deny from all
allow from 192.168.0.0/24
&lt;/limit&gt;</pre><p>Do you have any other reasons to ban IP addresses?  Have any code to share?  Please do!</p><p><a
href="http://davidwalsh.name/htaccess-security-allow-block-ips">Advanced .htaccess Security &#8211; Allow or Block Specific IPs From Your&nbsp;Website</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/htaccess-security-allow-block-ips/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Advanced .htaccess Security &#8211; Block Unwanted&#160;Referrers</title><link>http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers</link> <comments>http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers#comments</comments> <pubDate>Fri, 12 Oct 2007 12:26:34 +0000</pubDate> <dc:creator>David Walsh</dc:creator> <category><![CDATA[.htaccess]]></category> <category><![CDATA[Apache / Server]]></category> <category><![CDATA[Security]]></category><guid
isPermaLink="false">http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers/</guid> <description><![CDATA[For some bloggers and web developers, Digg can be a huge boost in traffic and thus a huge bust in ad revenue. Unfortunately, the Digg Effect can kill a website&#8217;s bandwidth and get the website shut down. Wouldn&#8217;t it be great if a weary web developer could prevent his site from being shut down by [...]<p><a
href="http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers">Advanced .htaccess Security &#8211; Block Unwanted&nbsp;Referrers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></description> <content:encoded><![CDATA[<p>For some bloggers and web developers, Digg can be a huge boost in traffic and thus a huge bust in ad revenue.  Unfortunately, the Digg Effect can kill a website&#8217;s bandwidth and get the website shut down.  Wouldn&#8217;t it be great if a weary web developer could prevent his site from being shut down by blocking users referred by Digg, at least a while?  Using a small bit of .htaccess code and mod_rewrite, the developer can do just that.</p><h2>The&nbsp;Code</h2><p><pre  class="js">RewriteEngine on
RewriteCond %{HTTP_REFERER} digg.com [NC]
RewriteRule .* - [F]</pre><p>Say good-bye to Digg Death with this small, easy-to-place snippet of code!</p><p><a
href="http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers">Advanced .htaccess Security &#8211; Block Unwanted&nbsp;Referrers</a> is a post from: <a
href="http://davidwalsh.name">David Walsh :: Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</a></p> ]]></content:encoded> <wfw:commentRss>http://davidwalsh.name/advanced-htaccess-security-block-unwanted-referrers/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 1/68 queries in 0.043 seconds using disk: basic
Object Caching 1429/1542 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 22:04:16 -->
