1. Redirect to Files or Directories
Redirect permanent /oldfile.html http://www.domain.com/filename.html or
Redirect 301 /oldfile.html http://www.domain.com/filename.html
Redirect 301 /olddirectory/oldfile.html http://www.domain.com/newdirectory/newfile.html
Redirect 301 www.olddomain.com/
Also you can program your home page to always load the www.domain.com version of the URL regardless of your actualy homepage file or a user not typing www.
1a.To redirect the non-www version use:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
1b.To preventĀ your default filename from loading use:
Options +FollowSymLinks
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
2. Change the Default Directory Page
Directory Index yourfilename.html
3. Allow/Prevent Directory Browsing
IndexIgnore */*
4. Allow SSI in .html files
AddType text/html .html AddHandler server-parsed .html AddHandler server-parsed .htm
5. Keep Unwanted Users Out
order allow,deny deny from 123.456.78.90 deny from 123.456.78 deny from .aol.com allow from all
6. Prevent Linking to Your Images
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com/.*$ [NC] RewriteRule .(gif|jpg)$ - [F]
7. Stop the Email Collectors
RewriteCond %{HTTP_USER_AGENT} Wget [OR] RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR] RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR] RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR] RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR] RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR] RewriteCond %{HTTP_USER_AGENT} ExtractorPro RewriteRule ^.*$ X.html [L]