DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Make Sure Your Site (or Directory) Is SSL Encrypted

  • submit to reddit
        Need a simple way to make sure all http requests get redirected to https?
This apache config snippet will redirect all requests at or below the specified location to its https equivilant.

<Location "/">
        RewriteEngine on
        Options +FollowSymLinks
        Allow from all
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]