02-19-2017, 01:21 AM #1
How many htaccess files should i have?
I was looking at some information on .htaccess files and some things that can be done with them but I am not sure if all of the things that I have been thinking about doing with them can be done with just one .htaccess file or if there should or can be multiples.
Does anyone know how many .htaccess files should i have?
02-19-2017, 03:12 AM #2
You can only create one .htaccess file for a website. This is the rule. because file manager do not allow you to create multiple .htaccess files. If you create multiple than it will overwrite your existing file.Blogging Tips & Tricks @ Blogwithvk.com
02-19-2017, 05:02 AM #3
You can have 1 htaccess file per folder on your website. You can have 1 in the root public_html folder and 1 in each sub folder and sub folder of a sub folder etc.
02-19-2017, 10:45 AM #4
02-19-2017, 06:20 PM #5
Don't make things difficult though. Keep it simple. The majority of sites that need htaccess only need 1 file in the root folder. If it's a membership site, then 1 in the members area folder also.
02-20-2017, 03:51 AM #6
02-20-2017, 05:10 AM #7
02-20-2017, 11:14 AM #8
You can upload only 1 htaccess file. .htaccess file is a configuration file used by Apache-based web servers that control access of web crawlers.
02-20-2017, 06:32 PM #9
03-20-2017, 11:26 AM #10
Have as many .htaccess as you require. I think there is no limit.
.htaccess in subdirectories can override RewriteRules of the parent directory .htaccess. Just add line: "RewriteEngine On" in "child" .htaccess to do so.
/home/john/public_html/.htaccess < parent / root folder of the web
/home/john/public_html/admin/.htaccess < child / subfolder
Last edited by postcd; 03-22-2017 at 07:55 AM.
03-21-2017, 11:56 PM #11
03-22-2017, 08:19 AM #12
Zack: It will override only rewrite rules (RewriteRule, RewriteCond) of your parent htaccess. I am not aware of any method that would stop inheriting everything from parent htaccess.
03-24-2017, 11:18 AM #13
05-17-2017, 10:42 AM #14
htaccess is very powerful when used properly and has a lot of action you can do from site optimization to website access etc.
Most sites use mainly 1 at the root to cater for all sub folders then an additional ones would be made to protect certain directories like a secure downloads folder to a members only or staff only area.
have a bit of a research on how to use them as they are very useful.
As a note you are never restricted to just 1 per site its actually 1 per folder and it will cater for all sub directories unless another one is put in place to override its parent directory settings.Storm Developers <> StormERP (Coming Soon)
05-17-2017, 11:13 AM #15
Listen to Rob above, he has it explained perfectly.
This is a question that comes up frequently in my college classes and I could not have explained it better and more succinct then Rob just did.
Don't make your web development life more difficult then it needs to be.
One in the public_html folder, this will pertain to all folders that do not have their own .htaccess and as Rob recommended for security reasons and file access limitations if you have a membership site, one in the members folder. This will normally have different configuration commands then the root folder based on what your members are allowed to do.
Do some reading on these file types. There are a lot of commands that can be included in the .htaccess file, many more than most people realize. Just remember test them before you upload them to a live site because with all that power, and they can be quite powerful, you can do a lot of damage, not physical but access wise, to your site if you do not understand the proper use of the commands.
Great explanation Rob.
Replies: 5 | Views: 1895Last post by Seller, 03-06-2017, 02:10 AM
Replies: 4 | Views: 1813Last post by HostaPolis, 03-12-2017, 04:37 AM
By Rob Whisonant in forum Make Money OnlineReplies: 6 | Views: 1387Last post by Seller, 03-15-2017, 08:37 AM
Replies: 6 | Views: 1674Last post by w3master, 03-09-2017, 12:04 PM
Replies: 2 | Views: 1690Last post by daniel27lt, 02-25-2017, 01:26 AM
By paul1129 in forum Search Engine OptimizationReplies: 6 | Views: 1762Last post by KarenByerly, 02-19-2017, 05:48 PM
By norled in forum Shared Hosting OffersReplies: 2 | Views: 2919Last post by norled, 03-01-2017, 10:02 AM
Replies: 6 | Views: 1869Last post by BestProxies, 03-03-2017, 10:56 AM
Replies: 4 | Views: 1949Last post by vishwa, 02-18-2017, 11:32 AM
Replies: 0 | Views: 31Last post by Game-Revenue, Today, 03:08 PM
Replies: 0 | Views: 19Last post by susanburling, Today, 01:00 PM
By watersquad in forum ServicesReplies: 0 | Views: 58Last post by watersquad, Today, 03:34 PM
Replies: 0 | Views: 71Last post by watersquad, Today, 03:28 PM
Replies: 2 | Views: 102Last post by Rob Whisonant, 02-15-2020, 07:33 PM
Replies: 1 | Views: 2760Last post by onliveserver, 06-30-2017, 10:55 AM
Replies: 0 | Views: 2859Last post by JerryJo, 04-09-2013, 04:31 AM
Replies: 0 | Views: 1295Last post by fantaseo, 04-01-2013, 02:39 AM
Replies: 1 | Views: 1987Last post by HostNurse, 02-24-2013, 08:26 AM
Replies: 2 | Views: 3420Last post by Eddy88, 07-30-2012, 10:43 AM