Posts

Showing posts from July, 2013

Htaccess Tips

1. Redirect to a secure https connection If you want to redirect your entire site to a secure https connection, use the following: RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 2. Block script execution You can stop scripts in certain languages from running with this: Options -ExecCGI AddHandler cgi-script .pl .py .php .jsp. htm .shtml .sh .asp .cgi 3.  Restrict file upload limits for PHP You can restrict the maximum file size for uploading in PHP, as well as the maximum execution time. Just add this: php_value upload_max_filesize 10M php_value post_max_size 10M php_value max_execution_time 200 php_value max_input_time 200 4. Force a file to download with a “Save As” prompt. If you want to force someone to download a file instead of opening it in their browser, use this code: AddType application/octet-stream .doc .mov .avi .pdf .xls .mp4 5. Compress file output with GZIP You can add the following code