0

I am trying to block direct access to certain folders using the code mentioned below on an .htaccess file.

It's works perfectly fine on Xampp (gives a 500 error when trying the access the folders directly), but on Wamp (it gives a 500 error or all pages, even the index page).

In Xampp, I have put the .htaccess file in the htdocs folder and in Wamp I am putting the .htaccess file in www folder.

What am I doing wrong?

RewriteEngine On
# Match directory names and forbid access with the F flag
RewriteRule  .*(Images|Videos|Scripts) - [F]
Valijon
  • 12,667
  • 4
  • 34
  • 67
Manu
  • 81
  • 9
  • Look in the error log what is causing the 500. There is no way for us to know. It could be that the rewrite module is not installed on the second server. – Pekka Jan 04 '16 at 16:13
  • @Pekka i just tried pasting the .htaccess file inside the 'images' folder instead of the www (root folder )and then it gives the 500 error only if i try to access the 'images' folder directly and i am also able to access all other folders without issues, this is good but this is not expected behavior, i should be able to put .htaccess file in www root folder and specify which folders to block direct access to, this should also prove that rewrite module is working.. – Manu Jan 04 '16 at 16:45
  • i just tried pasting the .htaccess file inside the 'images' folder instead of the www (root folder )and then it gives the 500 error only if i try to access the 'images' folder directly and i am also able to access all other folders without issues, this is good but this is not expected behavior, i should be able to put .htaccess file in www root folder and specify which folders to block direct access to, this should also prove that rewrite module is working.. – Manu Jan 04 '16 at 16:46
  • The log file will tell you exactly what the problem was – Pekka Jan 04 '16 at 16:46
  • @Pekka am a little new to apache rules stuff .... where do i get the log file .. thanks in advance – Manu Jan 04 '16 at 16:47
  • http://stackoverflow.com/questions/19713001/where-can-i-find-the-wamp-error-log – Pekka Jan 04 '16 at 16:48
  • Maybe you didnt have the rewrite_module activated on your XAMPP and therefore never saw this issue – RiggsFolly Jan 04 '16 at 17:51

0 Answers0