Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
file system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Sep 2008 at 09:05 UTC
Updated:
2 Jan 2016 at 21:20 UTC
Jump to comment: Most recent
Comments
Comment #1
DickSwart commentedComment #2
ainigma32 commentedAs mentioned in the forum post; IIS doesn't use .htaccess so there must be some other cause for this problem. Have you found the real cause of this problem yet?
- Arie
Comment #3
DickSwart commentedComment #4
DarkWingDuck-1 commentedI can confirm this, .htaccess file is used by iis with helm for the iispassword filter, which is used for protected folders.
http://www.iistools.com/en/iispassword.html
Comment #5
DarkWingDuck-1 commentedthe file shouldn't be created when running on iis.
Comment #6
ainigma32 commented@DarkWingDuck: That sounds a lot like a configuration using a third party tool that isn't really supported.
OTH I have to agree that creating .htaccess files on IIS is unnecessary and - in this case - unwanted.
So I suppose if you want to pursue this further you could look for a workaround for the short term (dare I say it ... hack core) and start creating a final solution for the long run.
I guess that final solution would be a feature request for a system setting that prevents Drupal from creating .htaccess files. If you can't get enough people to support implementing that in core you could always implement it using a contributed module.
So for the workaround: AFAICT the .htaccess files are created in /includes/file.inc on line 127
You could just comment out some lines or you could change the contents to suit your setup (helm)
Please note that you should not do this on *nix systems as that would compromise the security of the system
Please post back how that works out for you.
- Arie
Comment #7
DarkWingDuck-1 commentedThanks for the info and your time Arie,
That was what I was going to do at first, but putting an empty .htaccess file into the directory removed the need to touch the core.
An option in the settings was the first thing I was going to tell about, but this can be made even easier and simpler by adding an expression like "&& !$is_iis", removing the need for an additional setting.
I know IIS is not supported unless a new branch supports it but as you'll agree, no need to make it incompatible while a fix is so easy. You know, Helm is more than a 3rd party application, it's a typical configuration on a big number of shared hostings (though iis itself is not supported anyway).
I don't really know the structure of drupal.org team and community. Can't we ourselves make implementations in the core? Or is there a core team who only can make changes in the core? Just in case I have some time for it.
Thanks again,
Onur
Comment #8
ainigma32 commentedYou're absolutely right, using an empty .htaccess is the better choice. Hadn't thought of that :-)
Just adding the
is_iiswould be nice but there are two problems with that:So detecting the web server flavor would be nice and could be used to prefill the setting. But I think it would also need a manual override setting.
As for changes to core;all new features are developed in HEAD (at the moment Drupal 7.x)
You can write a patch and attach that to this issue. Next you set the issue to patch (code needs review) The patch should then be reviewed by the community and once the people looking at it are satisfied it looks OK the issue is set to patch (reviewed & tested by the community)
Finally the branch maintainer will have the final say whether or not the patch is applied.
Once a patch is applied to HEAD it can be back ported to an earlier version (like 6.9) The process is then repeated (although usually a lot faster) and then the branch maintainer if the 6.x branch will decide whether or not to apply the patch to the 6.x branch.
At that point you will be able to say you contributed code to software that is used by thousands of people all over the world :-D
See here http://drupal.org/patch for a more detailed description of the process.
It may look like a lot but once you've rolled one patch the next will be a breeze ;-)
Let me know what you think.
- Arie
Comment #9
DarkWingDuck-1 commentedThank you Arie, this was very informative. Btw no, it doesn't look a lot, it's an expectable workflow in a teamwork.
You're right about an option to override "is_iis". Strange, didn't know some servers do that. Actually I didn't know wordpress had such a variable, I just used it as a pseudo code, symbolizing a global variable or a function existed or to be added =)
Thanks,
Onur
Comment #10
ainigma32 commentedSince the problem was resolved I'm setting this to fixed.
Feel free to reopen if you think that is wrong.
- Arie
Comment #12
mecvo1984 commentedI had the exact same problem as the original poster but making the .htaccess file blank did not solve it for me. Files were uploaded but couldn't view them in a browser. IIS and NTFS permissions were properly set on IIS 6 Win 2003 latest Drupal. I also commented out the .htaccess section as suggested above and although the .htaccess is no longer being written when files are uploaded, still couldn't view files in a browser.
The answer was setting authentication in IIS to NTLM instead of Anonymous user access. Now all is well.
Comment #13
raprasad commentedHi,
I had a similar issue--the .htaccess file doesn't allow ImageCache to work. (I'm using Isapi_rewrite 3.0 on IIS--we have some legacy asp applications thus the windows server--ayy!)
I'm a bit stuck in that the following is happening:
(1) deleting the .htaccess file allows everything to work
(2) commenting out the files.inc code as in #6 above stops that file from writing the .htaccess
BUT
(3) the .htaccess file is still being written and I'm not sure from where.
For testing, I tried the following
(1) allowed files.inc to write the .htaccess file but added an additional line: "#from files.inc"--this line then appeared if the .htaccess file was deleted/re-created
(2) commented out the 'files.inc' code which writes the .htaccess. Deleted .htaccess. An .htaccess was created with the original content, no "#from files inc" but I'm not sure where it's being created from. (I flushed caches, restarted IIS, etc.)
I would appreciate any help!
Comment #14
raprasad commentedI ended up adding "RewriteEngine off" to my .htaccess file--and not touching the core.
Still not sure how the .htaccess file was being rewritten after files.inc was commented out . . .
Comment #16
Anonymous (not verified) commentedHi
i had the same problem ( using drupal 6.15 ). So I tried commenting out as was stated in the code from #6 ainigma32 but that lead to the whole site displaying a blank page. I then changed in the code where ".htaccess" was in that snippet to "htaccess.txt" and it worked.
I am still a noob at this and I am sure there are security implications - Please let me know if you know - but I am planning to move to a linux host asap and I figured this would be a quick and dirty fix just so that the client can view the page.
Comment #17
dvisan commentedThanks #16 Timothy.sea and all others. I am using a host that will not give me that much IIS permission, plus .htaccess files were never going to be supported with my configurations, so this was a brilliant solution for my Drupal 6.19 install.
Comment #18
mehD commentedJust create a folder named ".htaccess" where drupal will create the ".htaccess" file (sites/default/files/)
Comment #19
nazia.briti commentedActually, the lines those are to be commented are in the file of field_file.inc in the "filefield" module and also in the includes/file.inc file.
So, I've done the following in both of those files:
Comment #20
soheil1257 commentedhi dears. because using .htaccess file in IIS server are not useful and i did not find other way to prevent drupal to crate .htaccess file i forced to open includes/file.inc and find all .htaccess tags and I disable all block who contain .htaccess by inserting /* in first and */ at end of block .
its pertly works.
because of changing file.inc bye etch release of drupal i don't show the code how i changed.
Comment #21
saghez commentedHi
I had the same problem with Drupal 7
do the folowing steps, easy solution
1. Find (file.inc) in root of drupal site.
2. Edit it with notepad
3.Search for (file_put_contents )
4.You may find these:
", $variables, WATCHDOG_ERROR);
}
}
5.Just make comment by putting /* */ like following:
", $variables, WATCHDOG_ERROR);
}*/
}
6.Save the file.
7.Have Fun.