Configuring Apache HTTPD with .htaccess

The .htaccess file is a powerful directory-specific configuration file. You can use it to change a great deal of how your site behaves. Learn more about that below.

Rerouting from www

This trick is both for SEO and for personal gratification. I prefer to ditch the www subdomain in the address bar. While that arguably means less these days, it will ensure that you are not splitting the search engine ranking for your site between the parent domain and the (nearly-always-offered-and-simultaneously-identical) www subdomain which is generally available if you are using a common shared hosting service like 1&1 or GoDaddy.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.davideldridge\.org$ [NC]
RewriteRule ^(.*)$ http://davideldridge.org/$1 [R=301,L]

Rerouting to https

I made the move to https to placate the kind folks at Google. I understand that version 56 of their (Chrome) browser is going to have a warning letting users know that browsers are not secure if they are visiting a site without a certificate (plaintext/http/:80). And I am pretty opinionated on this. In light of the things that we learned through Edward Snowden’s whistleblowing,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 I think that it is imperative that we secure all of our web traffic. So, while it is certainly an inconvenience for web developers, it is of vital interest to people generally that me make this transition. Having said that, here is at least one way to skin the cat of rerouting to the secure version of your site:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

References

  1. The Guardian - Edward Snowden: The Whistleblower Behind the NSA Surveillance Revelations
  2. The Intercept - Inside the Assassination Complex: Whistleblowing Is Not Just Leaking, It’s an Act of Political Resistance
  3. WIRED - Edward Snowden: The Untold Story
  4. American Civil Liberties Union - Edward Snowden Is a Whistleblower
  5. Democracy Now! - "Edward Snowden Is a Patriot": Ex-NSA CIA, FBI and Justice Whistleblowers Meet Leaker in Moscow
  6. TED (ideas.ted.com) - Why Obama Should Pardon NSA Whistleblower Edward Snowden
  7. The Huffington Post - Edward Snowden Is a ‘Whistle-Blower,’ Rep. Justin Amash Says
  8. American Civil Liberties Union - Edward Snowden Is a Patriot
  9. Salon - Daniel Ellsberg: Edward Snowden Is a Patriot
  10. Rare - If Edward Snowden Isn’t a Whistleblower, There’s No Such Thing
  11. Politico - Edward Snowden Is a Patriot
  12. CNN - Eric Holder Says Edward Snowden Performed a 'Public Service'
  13. Washington Post - Edward Snowden, Patriot
  14. Huffington Post - Edward Snowden Is a Patriot
  15. Politifact - Hillary Clinton Claims Edward Snowden Had Whistleblower Protections, Didn't Use Them [Mostly False]