writing htaccess for newbie

writing htaccess for newbie

am 11.08.2007 08:03:06 von drum118

I have a hosting service using apache but does not come with a
htaccess file and I must write it.

Never done this before and not sure if this is correct.

As it stands now, I cannot over write existing files and get a file
that was removed months ago when I type in a link.

I am the only one that will have access to the file and want to make
sure no one can gain access to it and the site.

What else do I need before up loading the file?

The site is a huge drill down to various files folder as the site is a
large one holding over 10,000 photo's and that seam to be a problem
now. over 300 sub folders

thanks

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]


order allow,deny
deny from all


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/
RewriteRule \.(gif|jpg)$ http://www.davidfisher.biz/hotlink.gif [R,L]

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://davidfisher.biz/$1 [R=permanent]

ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 500 /error/500.html

#
# /abc/def/.htaccess -- per-dir config file for directory /abc/def
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g.
#

RewriteEngine On

# let the server know that we were reached via /xyz and not
# via the physical path prefix /abc/def
RewriteBase /xyz

# now the rewriting rules
RewriteRule ^oldstuff\.html$ newstuff.html