category      articles    
 
Adsense
Adwords
Article
Blog
CMS
CSS Style
Datacenter
Design Graphics
Flash Animation
Internet Radio
Messenger
Programming
Provider
Search Engine
Security
Security Web
SEF
SEO
Software
Software Web
Prevent htaccess From Hack 2

redirect for different domain name
code:
Redirect 301 / http://www.newdomain.com


Require the www
code:
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]


Redirect everyone to different site except 1 IP address (useful for web-development)
code:
ErrorDocument 403 http://www.someothersite.com
Order deny,allow
Deny from all
Allow from 24.33.65.6


CHMOD your files
chmod .htpasswd files 640
chmod .htaccess files 644
chmod php files 600
chmod files that you really don't want people to see as 400
NEVER chmod 777, if something requires write access use 766

Variable (mod_env) Magic
Set the Timezone of the server:
code:
SetEnv TZ America/Indianapolis


Set the Server Administrator Email:
SetEnv SERVER_ADMIN webmaster@htaccesselite.com

Turn off the ServerSignature
code:
ServerSignature Off


Add a "en" language tag and "text/html; UTF-8" headers without meta tags
code:
AddDefaultCharset UTF-8
# Or AddType 'text/html; charset=UTF-8' html
DefaultLanguage en-US


Use a custom php.ini

Detailed instructions for doing this whether you are using php as a cgi or the apache module mod_php

OTHER ARTICLES

AuthUserFile directive

CoreDumpDirectory directive

About ed at Linux

AllowOverride directive for Apache

AcceptFilter for Apache

ClearModuleList directive

AuthName directive for Apache

PHP and MySQL

AcceptMutex directive for Apache

Sendmail using PHP