Home › Forums › BulletProof Security Pro › Protect html files
- This topic has 19 replies, 2 voices, and was last updated 11 years ago by Young Master.
-
AuthorPosts
-
Young MasterParticipant
Hello. I have created a folder with html files in it in my root directory. Will BPS Pro protect that directory or do I need to put .htaccess file?
Thanks.
AITpro AdminKeymasterSee this Forum Topic for HTML .htaccess files for HTML websites.
http://forum.ait-pro.com/forums/topic/bps-html-htaccess-file-for-html-websites-or-subfolders/
Young MasterParticipantThank you very much but there is something I dont understand here below on the red text
# This file is created for HTML websites and HTML websites that are in a root website folder
# if you HTML website is in a subfolder then you will need to change the RewriteBase and RewriteRules
# to match that subfolder name/path
# Example: If an HTML website is in a subfolder called /example-html-website then the RewriteBase and
# RewriteRule in this file need to be changed using these examples below:
# RewriteBase /example-html-website/
# RewriteRule ^/example-html-website/index\.htm$ – [L]
# RewriteRule . /example-html-website/index.htm [L]The path of that html directory is /home/xxxx/public_html/matokeo/acsee/2013/index.htm
So how do i create those rewrite rules?
AITpro AdminKeymasterInternal folder/file paths are different than URL paths. If you have a subfolder website in a folder called /example-subfolder/ then the URL equivalent is example-root-domain.com/example-subfolder/
RewriteRules use URL paths not internal folder/file paths.
if you have a root website then the RewriteRule is just /index.html
if you have a subfolder website then the RewriteRule is /subfolder-name/index.html
The eqivalent of this internal folder/file path: /home/xxxx/public_html/matokeo/acsee/2013/index.htm
as a URL is example.com/index.html
Correction:
if the matokeo and acsee folders are internal folders/URL paths and assuming that 2013 is a permalink then you would have a RewriteRule like this.
/acsee/index.html
Young MasterParticipantAnd also where do I put that .htaccess file?
I would like to put that .htaccess file here /home/xxxx/public_html/matokeo
since there will be more subfolder inside matokeo folder with html files in it. Will it work or do I need to put that .htaccess file on every subfolder inside that matokeo folder?
eg: /home/xxxx/public_html/matokeo/acsee/2013/index.htm
/home/xxxx/public_html/matokeo/csee/2014/index.htm
/home/xxxx/public_html/matokeo/tcu/2013/index.htm
And assuming that 2013 and 2014 are permerlinks.
AITpro AdminKeymasterhtaccess files are heirachical / recursive
If a parent folder has an .htaccess file – all subfolders of that parent folder will follow the rules in the parent .htaccess file.
Each subfolder/website should have its own .htaccess file – this is the right way to do it for many technical reasons that do not need to be explained.
parent/.htaccess
parent/subfolder1/.htaccess
parent/subfolder2/.htaccess
parent/subfolder2/subfolder-child/.htaccess
The RewriteRule for a website in the /matokeo/ folder is: RewriteRule /matokeo/index.html
The RewriteRule for another website in the /matokeo/other-website/ folder is: RewriteRule /other-website/index.html. NOTE: you do not include the path from the parent folder. You are only rewriting based on the RewriteBase where the actual website is located.
NOTE: if the matokeo website is aliased to the root domain then it is actually a root website and not a subfolder website and would have a root website RewriteRule /index.html
Young MasterParticipantThank you very much…so If i understood you correctly. I will have to put that .htaccess file on the parent folder and subfolder. Am I right?
NOTE: if the matokeo website is aliased to the root domain then it is actually a root website and not a subfolder website and would have a root website RewriteRule /index.html
and will you please explain the above statement so that I can understand what you are trying to tell me. Thanks.
AITpro AdminKeymasterEach website needs its own .htaccess file. The most important reason for this is you are compartmentalizing security for each site. Most likely you would not need to change any security rules/filters individually for an HTML site, but the best design practice is to have individual control of each site.
For example let’s say you have 2 websites. WebsiteA and WebsiteB
WebsiteA is a root website and WebsiteB is a subfolder site under WebsiteA
WebsiteA has an application installed that requires that you change security rules/filters to allow certain things. You want WebsiteB to be completely locked down and using all of the security rules/filters. By using 2 different .htaccess files you can create separate website security control for each website.
AITpro AdminKeymasterWhat is the primary domain account for your Hosting account?
What is in the matokeo folder? Is it a separate domain name for a separate website?
What relation does your primary domain account have with whatever is in the matokeo folder?
For example: If you are creating folders for websites like these below off of the root folder/primary domain for your Hosting Account then these websites/domains are aliased domains/websites.
this is your root /public_html/ This folder translates to / in URL structure. Your example primary root domain is example.com/
/some-website.com
/another-website.com
These websites are aliased to the primary root domain and the URL structure is this.
some-website.com/
another-website.com/
Young MasterParticipantMy primary domain is xxx.com
There is nothing in matokeo folder just an empty folder with another folder inside of it.
My primary domain doesnt have any relation with whatever is in matokeo folder
Let me put it this way to make things clear. For example in the following paths
home/xxxx/public_html/matokeo/acsee/2013/index.htm
/home/xxxx/public_html/matokeo/csee/2014/index.htm
/home/xxxx/public_html/matokeo/tcu/2013/index.htm
The folders with red color these are empty folders with nothing in it just an empty folder with a sub folder in it.
The folders with blue color the are folders with html files in it.
AITpro AdminKeymasterActually just post the URL’s to the websites. Internal folder/file paths do not tell me what is in the folder, if it is a website or anything else for that matter.
AITpro AdminKeymasterIf you do not have websites in these folders then you do not need to add .htaccess files in them. The .htaccess file in the parent/root domain of your site will automatically protect all subfolders.
Young MasterParticipantno I do not have website for these folders. these are just folders with html files in containing some information like examination results but they are not website.
AITpro AdminKeymasterOk then you don’t need to add .htaccess files in these folders then because the root .htaccess file will already protect these files. I thought you were talking additional HTML websites not just HTML files.
Young MasterParticipantHa ha haaa!!! no not additional website just html files.
-
AuthorPosts
- You must be logged in to reply to this topic.