I don’t pretend to be an ‘Apache Expert’, in fact I don’t pretend to be an expert in anything…. But a little knowledge is very handy…
Here’s a great article that I found helpful on several occasions.
http://corz.org/serv/tricks/htaccess2.php
Handy examples are:
# users can load only "special.zip", and the css and js files. Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !^(.+)\.css$ RewriteCond %{REQUEST_FILENAME} !^(.+)\.js$ RewriteCond %{REQUEST_FILENAME} !special.zip$ RewriteRule ^(.+)$ /chat/ [NC]
Here we take the whole thing a stage further. Users can access .css (stylesheet) and Javascript files without problem, and also the file called “special.zip”, but requests for any other file types are immediately redirected back up to the main “/chat/” directory. You can add as many types as you need. You could also bundle the filetypes into one line using | (or) syntax, though individual lines are perhaps clearer.
I often use:
# Send all pages with /vote/ in the URL to the vote.php page for processing RewriteRule ^vote/(.*)$ /vote.php?req=$1 [L,QSA]
Main Category