Back to the index page  
  FAQ   Search   Memberlist   Usergroups   Register   Profile      Log in 
currawong.net .htaccess with comments.

 
Post new topic   Reply to topic    The Xserve Chronicles Forum Index » htaccess View previous topic :: View next topic  
currawong.net .htaccess with comments.
 PostPosted: Mon Apr 24, 2006 2:14 am Reply with quote  
Message
  Currawong

Joined: 22 Apr 2006
Posts: 3

This is the .htaccess for currawong.net. I think the order of items is wrong though - but it works, so i don't care Wink
Some of the regexp is a bit lazy, so be warned! I buggered around with the file for ages adding and removing all sorts of bits over time or trying things different ways. Anyone reading it and cringing note that it was far worse than this before!

# The IfModule bit isn't needed really, what webserver doesn't have it?
<IfModule>
# Turn re-writing on - duh
RewriteEngine On

# Redirects / to macdash and ignore further rules. [L] = last
RewriteRule ^$ http://macdash.com/cnet/ [R,L]

# Redirects all other requests to macdash and ignore further rules
# If the request isn't "!" a file "-f" or directory "-d" then
# rewrite the part of the request "(.+)" from the beginning of the request "^"
# to that same request "$1" at http://macdash.com/cnet/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) http://macdash.com/cnet/$1 [R,L]

# Hotlink prevention for images and movies, unless they are hotlinked from
# the 3 sites mentioned. [F] = Fail (or maybe F*** off)
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?currawong.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?appletalk.com.au/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?macdash.com/.*$ [NC]
RewriteRule \.(gif|jpg|mov|mpg|wmv|avi|mp3)$ - [F]

# Request for currawong.net/<anything>/ tries for a static page if the directory doesn't exist (!-d).
# Note that this is a reference to Geeklog's static page system. I set this up
# because I used to have subdirectories for certain sections on the site that
# I moved to Geeklog's static pages module instead. I used QSA (Query String
# Append) here so that the url accessed doesn't change, even though it's
# loading a different url. Also, it doesn't work if the url requested contains
# a "." or a "?" as the request would then be for a file or php page.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.\?/]+)/$ /s/index.php?page=$1 [QSA]

</IfModule>

# Prevent anyone getting an index of files by showing nothing in empty directories.
IndexIgnore .*
# This SHOULD be instead:
# Options -Indexes
# and IndexIgnore should be used for individual file types

# Basic redirects
Redirect permanent /nazirene http://nazirene.currawong.net
Redirect permanent /scripts http://scripts.currawong.net

# Redirectmatch is cooler, as you can use regexp. Really, it's not
# any different to ReWrite except that it gives a redirect code back
# to the browser, and to the web logs.
# I decided for Themer to use a text page instead of a static page
# in the Geeklog, so the first one is commented out.
# RedirectMatch permanent ^/aquaworld/(.*)\.(sit|zip|dmg)$ http://currawong.net/s/index.php?page=themer
RedirectMatch permanent ^/aquaworld/(.*)\.(sit|zip|dmg)$ http://currawong.net/themer.txt

# These are similar to the rewrites above, but I don't use them.
# RedirectMatch /(.*) http://macdash.com/cnet/$1
# RedirectMatch /(gallery|gallery/)? http://macdash.com/cnet/$1
View user's profile Send private message
Post new topic   Reply to topic    The Xserve Chronicles Forum Index » htaccess

Page 1 of 1
All times are GMT - 8 Hours

Display posts from previous:

  

Jump to:  
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