<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mod_rewrite on Evan Hoffman</title><link>https://evan.wtf/tags/mod_rewrite/</link><description>Recent content in Mod_rewrite on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Fri, 08 Oct 2010 18:11:42 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/mod_rewrite/index.xml" rel="self" type="application/rss+xml"/><item><title>Putting up a "down for maintenance" message using mod_rewrite</title><link>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite-2/</link><pubDate>Fri, 08 Oct 2010 18:11:42 +0000</pubDate><guid>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite-2/</guid><description>&lt;p&gt;Putting this here for safekeeping so my future self can find it. Mod_rewrite is one of my favorite tools, but it&amp;rsquo;s easy to spend 30 minutes crafting a 2-line directive that actually does what you want. I put this in a .htaccess file in the DocumentRoot of the server, put a &amp;ldquo;We&amp;rsquo;re down&amp;rdquo; message in maintenance.html (or whatever), and all requests will get a 302 redirect to /maintenance.html, except requests for /maintenance.html (for obvious reasons). It appends the original request in case you want to do something with it but that&amp;rsquo;s not really important. It also doesn&amp;rsquo;t do the redirect for images/js/css so those can actually be used in the maintenance message.&lt;/p&gt;</description></item><item><title>Putting up a "down for maintenance" message using mod_rewrite</title><link>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite/</link><pubDate>Fri, 08 Oct 2010 18:11:42 +0000</pubDate><guid>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite/</guid><description>&lt;p&gt;Putting this here for safekeeping so my future self can find it. Mod_rewrite is one of my favorite tools, but it&amp;rsquo;s easy to spend 30 minutes crafting a 2-line directive that actually does what you want. I put this in a .htaccess file in the DocumentRoot of the server, put a &amp;ldquo;We&amp;rsquo;re down&amp;rdquo; message in maintenance.html (or whatever), and all requests will get a 302 redirect to /maintenance.html, except requests for /maintenance.html (for obvious reasons). It appends the original request in case you want to do something with it but that&amp;rsquo;s not really important. It also doesn&amp;rsquo;t do the redirect for images/js/css so those can actually be used in the maintenance message.&lt;/p&gt;</description></item><item><title>Forcing Wordpress administration over SSL</title><link>https://evan.wtf/2010/09/20/forcing-wordpress-administration-over-ssl/</link><pubDate>Mon, 20 Sep 2010 15:46:05 +0000</pubDate><guid>https://evan.wtf/2010/09/20/forcing-wordpress-administration-over-ssl/</guid><description>&lt;p&gt;I never like typing a password into a non-SSL site, no matter how trivial it is. In order to give my own site this ability I simply used mod_rewrite to force requests to Wordpress&amp;rsquo;s admin pages to go over SSL.&lt;/p&gt;&#10;&lt;p&gt;The .htaccess file for the site looks like this:&lt;/p&gt;&#10;&lt;h1 id="begin-wordpress"&gt;BEGIN WordPress&lt;a class="heading-anchor" href="#begin-wordpress" aria-label="Link to this section"&gt;&#10; &lt;svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"&#10; stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&#10; &lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/&gt;&#10; &lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/&gt;&#10; &lt;/svg&gt;&#10; &lt;/a&gt;&#10;&lt;/h1&gt;&#10;&lt;p&gt;RewriteEngine On&#10;RewriteBase /evan/&#10;RewriteRule ^index.php$ - [L]&#10;RewriteCond %{REQUEST_FILENAME} !-f&#10;RewriteCond %{REQUEST_FILENAME} !-d&#10;RewriteRule . /evan/index.php [L]&lt;/p&gt;</description></item></channel></rss>