Page 1 of 1

htaccess not working??

Posted: Mon Jan 10, 2011 10:00 pm
by ibolui
hi, i know this question has been asked many times..and i have googled alot but i am still unable to get the desired result.

my .htacess is as below

Code: Select all

Options -Indexes
Options -ExecCGI
AddHandler cgi-script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi
<Files ^(*.jpeg|*.jpg|*.png|*.gif)>
order deny,allow
deny from all
</Files>
the Options -Indexes works but not the rest. because if i put a index.php with phpinfo(), i am able to view the php info.
if i remove |*.gif, i am still able to load gif files in the browser.
and if i put a text file in the directory, i am also able to load the text file.

anyone guide me what went wrong??

Re: htaccess not working??

Posted: Mon Jan 10, 2011 10:45 pm
by Benjamin
This is likely due to how AllowOverride is configured in the main apache configuration:

http://httpd.apache.org/docs/2.0/mod/co ... owoverride

Re: htaccess not working??

Posted: Tue Jan 11, 2011 1:09 am
by ibolui
hmmm... actually i am testing it in my development machine. i am using windows xp with xampp installed.
how do i check the directives are allow ALL??

btw, if i intend to make the directory serves only image files, and there are subfolders, do i need to include each subfolder with the htaccess as well??

thanks :)

Re: htaccess not working??

Posted: Sat Jan 15, 2011 4:19 am
by josh
Intentionally insert a defect into the .htaccess file, it should generate a 500 server error if Apache is configured to parse it. If you get no error, the issue is as Benjamin says. If you get an error then the .htaccess is being loaded but the issue is due to invalid syntax. This is called "divide & conquer"

Re: htaccess not working??

Posted: Tue Jan 18, 2011 2:03 am
by Peter Kelly
ibolui wrote:hi, i know this question has been asked many times..and i have googled alot but i am still unable to get the desired result.

my .htacess is as below

Code: Select all

Options -Indexes
Options -ExecCGI
AddHandler cgi-script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi
<Files ^(*.jpeg|*.jpg|*.png|*.gif)>
order deny,allow
deny from all
</Files>
the Options -Indexes works but not the rest. because if i put a index.php with phpinfo(), i am able to view the php info.
if i remove |*.gif, i am still able to load gif files in the browser.
and if i put a text file in the directory, i am also able to load the text file.

anyone guide me what went wrong??
Hi, just an observations but can I ask how you spelt the file as it should be .htaccess thats with 2 c characters just I noticed in the first post it is spelt incorrectly this could be a one off mistake but apache doesn't process it unless its spelt correctly.