SearchSearch   

writing htaccess for newbie

 
   Webmaster Forums (Home) -> Apache RSS
Next:  writing htaccess for newbie  
Author Message
drum118

External


Since: Aug 10, 2007
Posts: 2



(Msg. 1) Posted: Fri Aug 10, 2007 11:03 pm
Post subject: writing htaccess for newbie
Archived from groups: alt>apache>configuration (more info?)

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]

<Files .htaccess>
order allow,deny
deny from all
</Files>

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
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> Apache
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum