MODX Force SSL On A Specific Page

Add the below as a snippet, and include it BEFORE any output can happen on the page.

<?php
if($_SERVER["HTTPS"] != "on") {
   header("HTTP/1.1 301 Moved Permanently");
   header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
   exit();
}
?>

Twitter; Not Your Average Storm App

Last night was a first for me, and I presume a few others.

Around 1:00pm, the National Weather Service began issuing Severe Weather Storm warnings throughout my old stomping grounds back in Northeast Arkansas and up into Missouri.

Having witnessed many tornadoes growing up in Lake City, Pocahontas and Jonesboro Arkansas, I knew just how bad things could get, and fast.

One particular tweet caught my eye:

geeksmakemehot: Sirens going off in Pocahontas

I responded, asking for clarification. Back during WWII, Air-Raid sirens were installed by the federal government all over the nation, but many local principalities assumed their upkeep after the war and use them to warn the populace of particularly damaging storms. These days, we refer to them as “Tornado Sirens” or just “Sirens”; everyone knows what they mean: Duck!

It took @geeksmakemehot a bit to update her status, so while I was waiting, I popped over to the weather channel and made a quick search for “Pocahontas Arkansas”. Sure enough, a massive storm leading from as far south as Newport and as far north as the state line (and beyond) was slowly marching on my home grounds.

After tweeting as much data as I could, hoping to get updates from my friends back home, I noticed this tweet:

merlincam This is what makes twitter special #arwx @cottonr @tsudo

Ahh, a hastag! I popped over to twitter search, damning myself for having dumped TweetDeck, which would have automated the search for me, I typed in “arwx” and was surprised by the volume of tweets.

Most of the #ARWX tweets up to that point were personal updates:

chrislmarsh Good news! #ARwx Trees down on roof in East End area. My in-laws have no power right now. But everyone is OK. Thankfully!! /via @ghidotti

And from there, things actually went professional as the local weathermen got into the mix and began updating weather alerts and advisories. With power out over much of the area, some of the folks only had twitter to turn to for sources of information:

nick_b_jones Just lost cable on Bryant. Now totally dependent on #arwx on Twitter for weather updates.

I called my Mom back home and asked about her, she told me that it was raining, but only a commercial was on TV, so she wasn’t worried. I told her what I had learned so far and she interrupted me as a Severe Weather Alert began scrolling across the screen. Twitter had actually beaten her local weather team to the punch, for a change!

With lightning and thunder rocking the house, Mom wasn’t able to stay on the phone, but she promised to stay in touch as much as possible and hung up.

More twitter updates began to filter in, with a few people asking for more information. I quickly jotted back to the Weather Channel’s page on the storm and began tweeting what I learned, but the quality of my tweets was nothing compared to the concerned weather man @wxmandan, a meterologist out of Little Rock, Arkansas.

@wxmandan, whose real name is Dan Koch, stayed up with us until the wee hours of the morning, keeping us informed and relaying helpful bits of advice. If he said to take cover, you can bet these folks back home were rushing off to their safe places.

As the storm left the immediate area, Mom got in touch with me (via twitter of course) to let me know everyone there was safe. She also mentioned there was a rumor going around that someone in Pocahontas had been struck by lightning.

I asked the folks on the #ARWX feed about it and got this in reply:

StanMorris @ShanePLee Just sent a text to Randolph Sheriff Tribble asking him. Will report/tweet if that is the case.

A few minutes later:

StanMorris Randolph County Sheriff Tribble says no one struck by lightening in Pocahontas…a barn was struck that did catch fire. #arwx @ShanePLee

Not long after, things began settling down and I headed off to bed. With my phone. Keeping up with #ARWX, of course.

At this point, the majority of the incoming tweets were folks saying thanks to everyone for keeping them informed.

Now, in case you think this was all trivial stuff, I would like to point out that, during this time, 3 people were killed and 23 injured by tornadoes in the area. My heart goes out to the families of those who were taken and injured.

My only consolation is that perhaps it could have been worse, except for a wonderful group of people getting together in a social media platform and keeping each other updated on the latest storm data.

I would love to write more about the whole experience, but we are getting new messages in right now, calling for a new batch of storms over the same area. So pop by and experience this amazing expression of human kindness over at the #ARWX feed on twitter!

mod_rewrite to force www redirect index.php to domain

Here is a quick mod_rewrite example that forces www and redirects index.php to / (this fixes two canonicalization issues at one time).

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.site.com$
RewriteRule ^/(.*)$ http://www.site.com/$1 [R=301]
RewriteRule ^/index\.php$ http://www.site.com/ [R=301,L]