Useful .htaccess rules
Here's a nice list of useful rules related to apache2 .htacces files:
# Allow rewrite rules for the base URL:
RewriteEngine on
RewriteBase /
# Display all errors:
php_flag display_errors on
php_value error_reporting 7
# Check if the request is done via HTTPs:
RewriteCond %{HTTPS} off
# Redirect to HTTPs:
RewriteRule (.*) https://%{HTTP_HOST}/ [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/ [R=301,L]
# Prevent directory listings
IndexIgnore *
# R=307 stands for temporary redirect. Could be replaced with "NC":
RewriteCond %{REMOTE_ADDR} !^77\.238\.70\.90$
RewriteCond %{REQUEST_URI} !^/under_construction\.php$
RewriteRule ^(.*)$ /under_construction.php [R=307,L]
# Allow access from a given IP only:
deny from all
allow from 77.70.94.72