Allowing only certain files to view by .htaccess

user2897690

i have almost 20 pages on server, but i want only a file named abc.php, which users can watch. i want if user forcefully open the other files like //example.com/some.php .htaccess shows 403 error.

<Files ~ "^(?!(changepwd|login|register|remind|securitycode|registersuggest)\.php$).*(\.php)$">
AuthName "Reserved Area"
AuthType Basic
AuthUserFile path_to/.htpasswd
AuthGroupFile path_to/.htgroup
Order Deny,allow
Require group allowed_groups  
</Files>

this is the way i am currently using, but i think there can be more elegant solutions.

Atle

This .htaccess-file will only allow users to open index.php. Attempts to access any other files will result in a 403-error.

Order deny,allow
Deny from all

<Files "index.php">
    Allow from all
</Files>

If you also want to use authentication for some of the files, you may simply add the content from your current file at the end of my example.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Allowing only certain files to view by .htaccess

From Dev

Only allowing certain characters

From Dev

Allowing only domain root without slash in .htaccess

From Dev

Allowing Access to Only a Specific Path in .htaccess

From Dev

Allowing only certain HTML tags as user input

From Dev

Allowing only certain HTML tags as user input

From Dev

htaccess redirect only certain paths

From Dev

scp certain files only

From Dev

VMWare Fusion 6.0.2 Network Bridging is allowing only certain specific traffic

From Dev

Split different entries into separate rows allowing only certain combinations

From Dev

VMWare Fusion 6.0.2 Network Bridging is allowing only certain specific traffic

From Dev

Split different entries into separate rows allowing only certain combinations

From Dev

Allowing certain function call only if it is followed by another function

From Dev

Only allowing authenticated users to access certain pages in django

From Dev

Allowing words picked up in regex in certain cases only

From Java

How to unstash only certain files?

From Dev

rsync only certain types of files

From Dev

Move files with certain extensions only

From Dev

Git pull certain files only

From Dev

Htaccess: mod_rewrite (exceptions for certain files)

From Dev

.htaccess redirect unless from certain domain need help allowing search engines and not redirecting as with other visitors

From Dev

Allowing parameters with DOT in .htaccess

From Dev

.htaccess Question mark allowing

From Dev

.htaccess allow only one certain path from a certain ip

From Dev

htaccess prevent direct access to files while allowing rewrite rules to access them

From Dev

htaccess prevent direct access to files while allowing rewrite rules to access them

From Dev

Regex - Validate that the local part of the email is not ending with a dot while only allowing certain characters without using a lookbehind

From Dev

View git log (with merges) for only certain branches

From Dev

How to move view if only a certain textView is selected

Related Related

  1. 1

    Allowing only certain files to view by .htaccess

  2. 2

    Only allowing certain characters

  3. 3

    Allowing only domain root without slash in .htaccess

  4. 4

    Allowing Access to Only a Specific Path in .htaccess

  5. 5

    Allowing only certain HTML tags as user input

  6. 6

    Allowing only certain HTML tags as user input

  7. 7

    htaccess redirect only certain paths

  8. 8

    scp certain files only

  9. 9

    VMWare Fusion 6.0.2 Network Bridging is allowing only certain specific traffic

  10. 10

    Split different entries into separate rows allowing only certain combinations

  11. 11

    VMWare Fusion 6.0.2 Network Bridging is allowing only certain specific traffic

  12. 12

    Split different entries into separate rows allowing only certain combinations

  13. 13

    Allowing certain function call only if it is followed by another function

  14. 14

    Only allowing authenticated users to access certain pages in django

  15. 15

    Allowing words picked up in regex in certain cases only

  16. 16

    How to unstash only certain files?

  17. 17

    rsync only certain types of files

  18. 18

    Move files with certain extensions only

  19. 19

    Git pull certain files only

  20. 20

    Htaccess: mod_rewrite (exceptions for certain files)

  21. 21

    .htaccess redirect unless from certain domain need help allowing search engines and not redirecting as with other visitors

  22. 22

    Allowing parameters with DOT in .htaccess

  23. 23

    .htaccess Question mark allowing

  24. 24

    .htaccess allow only one certain path from a certain ip

  25. 25

    htaccess prevent direct access to files while allowing rewrite rules to access them

  26. 26

    htaccess prevent direct access to files while allowing rewrite rules to access them

  27. 27

    Regex - Validate that the local part of the email is not ending with a dot while only allowing certain characters without using a lookbehind

  28. 28

    View git log (with merges) for only certain branches

  29. 29

    How to move view if only a certain textView is selected

HotTag

Archive