The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> System Administration
> Apache Development
|
.htaccess for subfolder to ignore .htaccess in root folder
Discuss .htaccess for subfolder to ignore .htaccess in root folder in the Apache Development forum on Dev Shed. .htaccess for subfolder to ignore .htaccess in root folder Apache Development forum discussing HTTP Server general topics, configuration, and modules. Apache is an open source web server that runs on multiple platforms.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 20th, 2012, 08:45 PM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
|
.htaccess for subfolder to ignore .htaccess in root folder
I'm trying to make the .htaccess file in a subfolder (actually an add-on domain) NOT also process rules in the root folder.
I've spent the last hour or more searching Google...
Any assistance?
__________________
Thomas Tremain
|

March 21st, 2012, 01:13 AM
|
 |
Lost in code
|
|
|
|
|
As far as I know you can't. However, you can override most directives with a new value.
If by rules you mean rewrite rules though, it might not be possible to override them. Try putting RewriteEngine off into your subfolder .htaccess file. If that disables the rules, then you can override them. If it doesn't, then you can't.
If you can't, then you'll need to modify the rules in the parent directory's .htaccess file so that they don't apply to URLs referencing the subfolder.
For an add-on domain it does seem kind of odd that the parent directory's .htaccess file is being processed; if you're accessing the subfolder using the add-on domain directly I wouldn't think that the parent folder would be under the add-on domain's document root, and as far as I know, .htaccess files that are above the document root would not be processed.
|

March 21st, 2012, 02:31 AM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
Quote: | For an add-on domain it does seem kind of odd that the parent directory's .htaccess file is being processed; if you're accessing the subfolder using the add-on domain directly I wouldn't think that the parent folder would be under the add-on domain's document root, and as far as I know, .htaccess files that are above the document root would not be processed. |
That is what I show from tests on my own servers, as well. My client has yet to give me FTP access in to take a look at this account. I posted this based upon his notes, and the more I look, the more I think he's mistaken.
Apache on *MY* servers, map the add-on domain DIRECTLY to it's own folder, so the public_html/.htaccess should never be accessed.
This thread may be moot... Then again, you have probably confirmed what I thought to be true.
|

March 21st, 2012, 05:51 PM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
|
My client was correct. When he went to his add-on domain, it was reading the .htaccess file from the root domain.
I was then able to recreate this on my own servers...
The fix:
In the root of the add-on domain, I created a .htaccess file, and placed in it only:
RewriteEngine On
RewriteBase /
If I left the .htaccess file in this folder blank, it again read the .htaccess file for the primary domain.
All servers tested were running Centos, and cPanel.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|