Pagina 1 din 1

Access doar la anumite fisiere, cu htaccess

Scris: Vin Dec 02, 2016
de sterica
ca sa nu fiu nevoit sa adaug in htaccess, fiecare fisier ce nu vreau sa fie accesat direct din browser, am posibilitatea sa le includ pe toate by default si sa adaug doar exceptiile?

Multumesc!

Access doar la anumite fisiere, cu htaccess

Scris: Vin Dec 02, 2016
de MarPlo
Poti sa te folosesti de acest cod in htaccess:

Cod: SelectaĊ£i tot

# set index.php as default index file
DirectoryIndex index.php 

#set to not show directory structure
Options -Indexes

#block access to all not allowed files
order allow,deny

#allow access to these php files
<files ~ '(index|file_2|file_3)\.php$'>
 allow from all
</files>

#allow access to these html files
<files ~ '(index|404|file_2|file_3)\.html$'>
 allow from all
</files>

#access for browser to the: bmp, css, gif, htm, ico, jpg, json, js, pdf, png, txt, xml files
<files ~ '(.*?)\.(bmp|css|gif|htm|ico|jpg|json|js|pdf|png|txt|xml)$'>
 allow from all
</files>

#allow access to address without file name after domain/
<files ''>
 allow from all
</files>