user1951237
user1951237

Reputation: 53

How do I make a file usable by my app but not viewable in the browser?

I have a file in my app that's used by the app to determined settings such as max upload size, whether users can sign up or not ect. And I need it in the app director ao that people can change their local config. But unfortunately you can go /config/local.json and download it. I did think about making /config/ rewrite to a PHP page but that's kinda long but I may yet have to do that.

I am running PHP as an Apache module. Is there a way I can do this with .htaccess or something?

Upvotes: 1

Views: 184

Answers (2)

Hossein J
Hossein J

Reputation: 1019

Something like this could be acceptable in the .htaccess file:

<IfModule mod_php5.c>
    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 200
    php_value max_input_time 200
</IfModule>

Upvotes: 1

Akshat Goel
Akshat Goel

Reputation: 528

Well, you can keep the file outside the document root (one directory up from the base directory where you hold your site) and access that file from the script.

You can edit document root in your apache configuration file.

/etc/apache2/sites-enabled/000-default for *nix Environments

Upvotes: 0

Related Questions