<?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>American Butifarra &#187; plugin</title> <atom:link href="http://claude.betancourt.us/tag/plugin/feed/" rel="self" type="application/rss+xml" /><link>http://claude.betancourt.us</link> <description>Claude Betancourt&#039;s Personal Blog</description> <lastBuildDate>Fri, 16 Dec 2011 02:43:25 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Force a URL to Use HTTPS</title><link>http://claude.betancourt.us/how-to-force-a-url-to-use-https/</link> <comments>http://claude.betancourt.us/how-to-force-a-url-to-use-https/#comments</comments> <pubDate>Sat, 28 Feb 2009 03:02:55 +0000</pubDate> <dc:creator>Claude</dc:creator> <category><![CDATA[How-To]]></category> <category><![CDATA[Protocol]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[ColdFusion]]></category> <category><![CDATA[IIS]]></category> <category><![CDATA[MachII]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[Rewrite]]></category><guid isPermaLink="false">http://claude.betancourt.us/?p=385</guid> <description><![CDATA[Site owners sometimes need to make sure secure connections are used. They can do this quickly with this Apache rule. <a href="http://claude.betancourt.us/how-to-force-a-url-to-use-https/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p><span class="drop_cap">T</span>oday I came across some old ColdFusion <span class="amp">&#038;</span> Mach-II (1.0) code where a plugin was used to force HTTPS. I assume the original developer decided to go with this solution because the target environment was Windows and Internet Information Server.</p><p>The task becomes a lot easier under Apache. So I threw away the plugin code and added the following rule to the Apache configuration:</p><pre class="brush: xml; title: ; notranslate">
&lt;directory &quot;/public_html/mysite.com&quot;&gt;
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{HTTP_HOST}/$1	[R,L]
&lt;/directory&gt;
</pre><p class="alert">The directive above can be placed inside a <span class="amp">VirtualHost</span> or <span class="amp">Directory</span> directives, but this usually requires access to the Apache server configuration, which is not typically possible in a shared hosting environment &#8212; in that case, the rule can be added to the <span class="amp">.htaccess</span> file.</p><p>Alternatively we could have used the <a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslrequiressl">SSLRequireSSL Apache (2.x) directive</a>, but this would only block access to the non HTTPS address. In our case we want to automatically redirect the users instead of displaying an error message.</p> ]]></content:encoded> <wfw:commentRss>http://claude.betancourt.us/how-to-force-a-url-to-use-https/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Served from: claude.betancourt.us @ 2012-02-07 14:37:11 by W3 Total Cache -->
