I want to create some htaccess files for redirect, errors etc. but I'm not sure if I would have to create a seperate file for each task, or if I can include the code for each task all in one file e.g if I want a redirect for my site, plus custom redirect for 404's etc, plus say IP bans, can these all go in one file or do I do separate ones? And where do they need to go - in the root file of my site?
I'm pretty new to this so any help would be much appreciated.
07-16-2010, 08:34 AM
You place .htaccess files in your server's assigned document root (i.e. the place where you would put your website's "index" page). If you don't want the rules of the .htaccess file to apply to your entire site, then you can place them in sub-directories (e.g. rules applying to the blog/ directory -> place the .htaccess file in the blog/ directory etc. (very simple example) )
Your directories should only contain one .htaccess file - and you can add as many directives, rules and conditions as you want to a single .htaccess file - you can, however, have other .htaccess files in other directories.