How to redirect user to the index page , If they try to access browse file from directory browsing

Viewed 14

I want to restrict any user who try to browse the list of page through directory browsing , currently I am able to redirect user to index page if he try to access "xyz.leadangel.com/assets" but I am not able to redirect to index page if he try's to access "xyz.leadangel.com/assets/config.json" , config.json file is successfully get opened by any user even if it is not using our referrer domain which is xyz.leadangel.com/index.html#/ , I don't want that so please suggest some solution for this.

user should able to reach if it is coming from a referrer which xyz.leadangel.com/index.html#/

eg xyz.leadangel.com/assets/ --------------> redirect to xyz.leadangel.com/index.html#/

if some one try to open directly xyz.leadangel.com/assets/config.json ------------> it should redirect to xyz.leadangel.com/index.html#/

how can we achieve this using referrer which is https://xyz.leadangel.com/index.html#/

RewriteEngine On RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] 
RedirectMatch (.*)/assets/$ https://xyz.leadangel.com/index.html#/ 
RedirectMatch (.*)/assets/img/$ https://xyz.leadangel.com/index.html#/
RedirectMatch (.*)/assets/icons/$ https://xyz.leadangel.com/index.html#/
RedirectMatch  (.*)index.html#/client-login https://xyz.leadangel.com/index.html#/
0 Answers
Related