Author | htaccess problems |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Im trying to set up some pretty simple .htaccess configurations on my server, but am having some pretty confusing problems. Here is the file I have so far...
Code
<Files .htaccess>
order allow,deny
deny from all
</Files>
<Files ~ "\.txt$">
Order allow,deny
Deny from all
</Files>
IndexIgnore *
All I am trying to do is disable all dir listing, stop access from the url bar to files with a .txt extension, and of course prevent the htaccess file itself from being accessed.
I have put this file in the root of my server, so it should affect all files and folders on it (so I gather), but I have observed some pretty odd behavior.
If I access a folder on my server, I get a directory listing (www.server.com/folder)
If I access a .txt file in that folder, it gets denied (www.server.com/folder/test.txt)
If I access another subfolder, I get a listing (www.server.com/folder/folder)
If I access a file in that subfolder, I can view the contents (www.server.com/folder/folder/test.txt)
Can anyone see why this isnt working? I shouldnt be seeing these directory listings at all, and the .txt access is really confusing me...
Any help is much appreciated.
Cheers,
JJ
|
 |
Author | RE: htaccess problems |
clone4 Member

Posts: 586 Location: He is back and he's bad!
Joined: 25.11.07 Rank: Mad User | |
check your httpd.conf file, search for htaccess string and you should find AllowOverride None directive. Change it to All, and restart the server
Oh and maybe instead of IndexIgnore *, you could use Options -Indexes, which will return 403 forbidden rather then empty index...
Also httpd.config denies by default access to htaccess files, so no necessity to include that...
[img][/img]

spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl
Edited by clone4 on 02-05-09 18:07 |
 |
Author | RE: htaccess problems |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Nice one :D
For some reason my httpd.conf seems pretty empty, theres only 5 lines, no comments or anything I expected to see.. Installed from an apt repo as well.
*edit* Still no joy, I have placed the following lines in my httpd.conf:
Code
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
But still no luck...
Edited by on 02-05-09 19:28 |
 |
Author | RE: htaccess problems |
clone4 Member

Posts: 586 Location: He is back and he's bad!
Joined: 25.11.07 Rank: Mad User | |
jjbutler88 wrote:
For some reason my httpd.conf seems pretty empty, theres only 5 lines, no comments or anything I expected to see.. Installed from an apt repo as well.
That certainly isn't right... Check this http://www.devsid. . .httpd-conf. I'd send you mine, but currently I'm working under windows
[img][/img]

spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl
|
 |
Author | RE: htaccess problems |
clone4 Member

Posts: 586 Location: He is back and he's bad!
Joined: 25.11.07 Rank: Mad User | |
MoshBat wrote:
Repos are tailored for the OS, not your use...
but still 5 lines for a server config file seems a little weird to me...
@jjbutler: Have you restarted the server? (I know trivial, but I often forget to do that)
Also:
Code
<Directory "here should be full path to your www folder">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
[img][/img]

spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl
Edited by clone4 on 02-05-09 19:43 |
 |
Author | RE: htaccess problems |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Yeah, I have absolutely no idea how my apache was running with a 5 line config file, got the full version modified now, fixing it up for the errors then gonna give it a spin.
Edited by on 02-05-09 20:05 |
 |
Author | RE: htaccess problems |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Solved! Props to moshbat and clone4 for the help.
The real problem resided in the file '/etc/apache2/sites-available/default'. After changing the AllowOverride to All in there, everything was ok.
Cheers guys 
|
 |