Archive for the ‘htaccess’ Category

How To Create Custom Error Pages

March 19th, 2010 by admin 0

Within your .htaccess file add the following lines (and obviously change the filesnames/directories to suit your own needs):

ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html

Forcing / Removing WWW with htaccess

February 19th, 2010 by admin 0

Add the following snippets to your htaccess file:
Forcing:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-site.com [NC]
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]

Removing

RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]

How to force files to download (not open in browser window)

February 19th, 2010 by admin 0

Simply create a .htacess file and copy and paste the following lines:

AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf