Title: .htaccess
Last modified: August 22, 2016

---

# .htaccess

 *  [olifantje](https://wordpress.org/support/users/olifantje/)
 * (@olifantje)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/)
 * Does .htaccess in public_html have final say?
    I thought the .htaccess file in
   public_html overwrites other .htaccess in other directories. So whatever is in
   that .htaccess file, it will be applied everywhere. The one in cgi-bin directories
   only works for the directories and paths inside the cgi-bin directory. Same as
   the htaccess in wp-admin and others. Is this true?
 * And what happens when both .htaccess have the same rules, except the htaccess
   in wp-admin says “allow” and the public_html says “deny”? Will the rules in public_html
   always overrule?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551579)
 * > I thought the .htaccess file in public_html overwrites other .htaccess in other
   > directories.
 * In my own limited experience, a second .htaccess *can* over-rule the first *unless*
   the first (at least initially) sends a domain on past it. For example, I have
   my Primary Domain assigned to public_html where it is then re-directed to a sub-
   folder, and the .htaccess there in public_html tells my domain what to do when
   it arrives at its sub-folder. But if my domain cannot find at the sub-folder 
   what it was sent there to do, then the .htaccess in my sub-folder takes over 
   to handle the error (404).
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551588)
 * > I thought the .htaccess file in public_html overwrites other .htaccess in other
   > directories. So whatever is in that .htaccess file, it will be applied everywhere.
 * I just now happened to see this affirming at least that part:
 * > .htaccess files follow a hierarchy. Whatever directives are in the top-level.
   > htaccess file flow down and apply to all directories below it.
   >  [http://wordpress.stackexchange.com/questions/20152/cannot-access-non-wordpress-subdirectories-as-wordpress-overrides-them-with-a-40](http://wordpress.stackexchange.com/questions/20152/cannot-access-non-wordpress-subdirectories-as-wordpress-overrides-them-with-a-40)
 * However, I believe it is still possible for a later ‘`RewriteEngine Off`‘ to 
   stop certain actions.
 *  Thread Starter [olifantje](https://wordpress.org/support/users/olifantje/)
 * (@olifantje)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551660)
 * Thanks, so I can assume that if de top-level htaccess says “no” the ones below
   that have a htaccess that says “yes”, it wil stil be a “no”.
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551664)
 * > …so I can assume that if the top-level htaccess says “no” the ones below that
   > have a htaccess that says “yes”, it wil stil be a “no”.
 * Edit: Oops, no, I think the latter will re-write the rule.
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551665)
 * Here is a comprehensive tutorial and guide:
 * [http://perishablepress.com/stupid-htaccess-tricks/](http://perishablepress.com/stupid-htaccess-tricks/)
 *  Thread Starter [olifantje](https://wordpress.org/support/users/olifantje/)
 * (@olifantje)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551695)
 * thanjs for the ‘stupid’ tricks :p will take a look!
 * About your edit, are you as confused as I am? I think I’m going to try it out
   to be sure, because I still don’t understand the exact hierarchy.
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551701)
 * > About your edit, are you as confused as I am? I think I’m going to try it out
   > to be sure, because I still don’t understand the exact hierarchy.
 * I only have one eye that can read, and my edit came about after I had realized
   I had mis-read what you had posted!
 * I am just beginning to learn about .htaccess beyond copy-and-paste from other
   sources, but, and as an example here, I believe ‘`RewriteEngine On`‘ turns it
   on and it remains that way until Apache might be given a ‘`RewriteEngine Off`‘
   order from wherever. More to the point here, I believe a ‘`RewriteRule ...`‘ 
   applies wherever and both in the immediate and well as later either unless or
   until a new-and-related ‘`RewriteRule ...`‘ is encountered by Apache.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘.htaccess’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [file management](https://wordpress.org/support/topic-tag/file-management/)
 * [ftp](https://wordpress.org/support/topic-tag/ftp/)
 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)
 * [public_html](https://wordpress.org/support/topic-tag/public_html/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/htaccess-63/#post-5551701)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
