stop direct access (.htaccess) and allow ajax request to subfolder

后端 未结 5 791
情书的邮戳
情书的邮戳 2020-12-20 01:42

I am trying to stop direct access to a subdirectories and the php files within subdirectories. I\'ve added the following code below to the .htaccess file within the subdirec

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 02:19

    You can use mod_rewrite to restrict access to all bet certain files in a directory. Add this to the .htaccess in that directory.

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !(jsonp)|(ws)|(ajax)
    RewriteRule .* - [R=404,L]
    

    Just replace the jsonp ws ajax with the name of your files.

提交回复
热议问题