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.
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: 1658Last post by Seller, 03-06-2017, 02:10 AM
Replies: 4 | Views: 1673Last post by HostaPolis, 03-12-2017, 04:37 AM
By Rob Whisonant in forum Make Money OnlineReplies: 6 | Views: 1242Last post by Seller, 03-15-2017, 08:37 AM
Replies: 6 | Views: 1490Last post by w3master, 03-09-2017, 12:04 PM
Replies: 2 | Views: 1482Last post by daniel27lt, 02-25-2017, 01:26 AM
By paul1129 in forum Search Engine OptimizationReplies: 6 | Views: 1523Last post by KarenByerly, 02-19-2017, 05:48 PM
By norled in forum Shared Hosting OffersReplies: 2 | Views: 2577Last post by norled, 03-01-2017, 10:02 AM
Replies: 6 | Views: 1732Last post by BestProxies, 03-03-2017, 10:56 AM
Replies: 4 | Views: 1796Last post by vishwa, 02-18-2017, 11:32 AM
By HostXNow in forum Reseller Hosting OffersReplies: 0 | Views: 93Last post by HostXNow, 10-10-2019, 02:16 PM
By HostXNow in forum Shared Hosting OffersReplies: 0 | Views: 100Last post by HostXNow, 10-10-2019, 02:12 PM
By PaymentGateway in forum Search Engine OptimizationReplies: 3 | Views: 105Last post by PaymentGateway, Today, 05:12 AM
By arindamb in forum Social Media MarketingReplies: 1 | Views: 176Last post by ethelglover, 10-12-2019, 04:39 AM
Replies: 1 | Views: 132Last post by vishwa, 10-09-2019, 05:56 AM
Replies: 1 | Views: 2501Last post by onliveserver, 06-30-2017, 10:55 AM
Replies: 0 | Views: 2723Last post by JerryJo, 04-09-2013, 04:31 AM
Replies: 0 | Views: 1212Last post by fantaseo, 04-01-2013, 02:39 AM
Replies: 1 | Views: 1882Last post by HostNurse, 02-24-2013, 08:26 AM
Replies: 2 | Views: 3311Last post by Eddy88, 07-30-2012, 10:43 AM