The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
htaccess File Help
My server setup has multiple .htaccess files (which I'm guessing may be normal).
Server setup is public_html directory...then forums sub-directory. Both the public_html directory & forums sub-directory each have a .htaccess file. My questions are: 1. How do each of these .htaccess files work together (if they do)? 2. Should each of them contain the exact same information...or should the higher up public_html directory have less/more info...or should the lower sub-forums directory have more/less info in it? I'm sure I will have follow up questions...but wanted to get these 2 out of the way first. Thanks |
#2
|
|||
|
|||
Basically what you need to know is that a .htaccess file in a parent directory will affect all child folders of it. So knowing this, you can set your rules as needed.
|
#3
|
|||
|
|||
Quote:
Thus here are two hypothetical situations...anyone please let me know if what I'm stating makes sense (or not): 1. If an .htaccess file in a parent directory effects all child folders or directories in it. In theory..does it make sense that a child directory could have more rules or more restrictions than the parent directory? 2. In theory...could a parent & child directory have exactly the same .htaccess file rules...and everything work fine (basically both parent & child directory have exactly the same duplicated .htaccess file)? And here's one additional question. Looking at my websites server setup...is it basically a given that almost all parent & child directories have an .htaccess file? Most of mine do...but I do see some that don't. Thanks |
#4
|
|||
|
|||
1. A child directory inherits the parent .htaccess rules and you can apply additional rules to the child .htaccess file as well.
2. If the child directory has no .htaccess file then it will inherit the parent .htaccess file. However keep in mind that, depending on the rules that have been defined in the parent .htaccess file, it might not match in the child directory. Whether or not you need a .htaccess file in all directories depends entirely on your configuration and needs. |
#5
|
|||
|
|||
Thanks Dave. Some followup questions:
Quote:
Could the child directory run properly without any .htaccess file at all...or would the child directory need it's own .htaccess file & it would look exactly the same as the parent directory .htaccess file? Quote:
Quote:
The .htaccess files for my site contain a lot of "rewrite" rules as well...which I guess I need to learn more about in general...and how they are working specifically for my site. Thanks |
#6
|
|||
|
|||
Yes, the child directory can run without its own .htaccess file if it meets the parent .htaccess rules. If you add 3 rules in a .htaccess file in the child directory, it will inherit the parent rules and load the 3 additional rules.
The most popular feature of .htaccess is "RewriteRule" where if a certain condition is met, it redirects either the user or request internally to a different script or page. You can also deny access based on IP addresses like you said. The rewrite rules are commonly used for clean URL's. For example a page at example.com/category/subcategory/productname might rewrite the URL behind the scenes to example.com/index.php?route=category/subcategory/productname where the framework that runs behind the scenes parses the URL and further processes it to show the proper page. Here is a good source for you https://httpd.apache.org/docs/curren.../htaccess.html |
#7
|
|||
|
|||
Thanks again Dave.
Quote:
I guess I was thinking that if the child directory didn't have it's own .htaccess file...then there would be no rules for the child directory not to meet...and thus access to the child directory would be the same as the parent directory. But then again...I guess there are all sorts of .htaccess rules...more than just access related. Quote:
Thanks again. |
#8
|
|||
|
|||
For example the .htaccess rules in the parent directory might have a rule such as "if the URL contains /some/directory, redirect to location X" but this rule might never be met in the child directory.
Here are 2 more good sources for you: http://www.htaccess-guide.com/ and https://code.tutsplus.com/tutorials/...iles--net-4757 |
#9
|
|||
|
|||
Awesome. Thanks for the links Dave.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|