ratcateme Posted February 4, 2009 Share Posted February 4, 2009 I haven't really used .htaccess to much in the recent past and i am having some trouble blocking the include files from being read i have this in my .htaccess file <Directory /var/www/html/notes/> <Files .inc> Order Allow,Deny Deny from all </Files> </Directory> thinking that should block all files ending in .inc but when i go to /notes/xajax.inc i can view the file. where have i gone wrong? Scott. Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 That will protect a file named .inc you need to use a wildcard. <Directory /var/www/html/notes/> <Files *.inc> Order Allow,Deny Deny from all </Files> </Directory> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Author Share Posted February 4, 2009 thanks thorpe but still not working i put that and only that in /var/www/html/notes/.htaccess and still nothing i can still view all my .inc files i also tried <Directory /var/www/html/notes/> <Files "*.inc"> Order Allow,Deny Deny from all </Files> </Directory> and without the <Directory> parts and without the quotes but i am a real beginner with htaccess and i can't seem to be able to work out how they should be used the google examples also seem a bit strange to me. i also check thought the server config and confirmed: AccessFileName .htaccess Scott. Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Try.... <Files "\.inc$"> Order allow,deny Deny from all </Files> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Author Share Posted February 4, 2009 not working eithre before i tried that i went through my server config again it is a new server and found that AllowOverride was set to none on / and /var/www/html i have set both to all and still wont work is there any way i can confirm my htaccess file is being run? i am using apache 2.2 Scott. Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Sorry, the tilde isn't working in code tags for some reason. It should be... <Files ~ "\.inc$"> If that doesn't work your .htaccess file isn't working. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Author Share Posted February 4, 2009 i tied that no luck i even added that to the bottom of my httpd.conf file and still nothing i can view all the files ending in .inc i even cleared the .htaccess file and restarted httpd and i can still view all of them where could i possible be missing something? i check /var/www/html/ and there are no htaccess files there i have absouly no clue what is going on Scott. Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Can you post any relevent parts of your httpd.conf and virtualhost configurations? Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Author Share Posted February 4, 2009 found the problem while looking through my configs i had one: <Location /> Order deny,allow Deny from all Allow from 127.0.0.1 Allow from 10. </Location> basically to block the entire server from the internet for the time but should that be overridden by the htaccess file? because as soon as i comment those lines out i get a 403 but when they are there it loads no problems is there a better way to block my site from the internet temporally but still have the htaccess configs working? or should i just take the port forward from my router? Scott. Quote Link to comment Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 is there a better way to block my site from the internet temporally but still have the htaccess configs working? I would do it via my firewall rules. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 4, 2009 Author Share Posted February 4, 2009 cool thanks ill look into that still haven't got a good firewall working on it yet guess that will be a job for sometime in the future Scott. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.