How to prevent specific file to show in browser

How to prevent specific files like xml, jpg etc to show in browser but can be use in script.

Locate the file outside the document root served by the web server (eg: /home/rashidr/includes instead of /home/rashidr/httpdocs/includes). Alternatively, use Apache modules such as mod_alias (Redirect directive) or mod_rewrite (RewriteRule directive) to send requests to that file to a 404/401 error.

I don’t think that’s what’s being asked Dan… though honestly I can’t even make sense out of that question given the bizarre mixing of tense and nonsensical conjunctions.

Could someone translate the question into English for me?

I mean, if you block it 404-style, scripts can’t access it… Client side can either access it, or it can’t… Or does he mean server side scripts? Literally I can’t make any sense out of that.

This is the PHP forum, so you would assume he means PHP scripts. They can access files outside the document root as they’re not being accessed through a web server.

My first thought would be to use a .htaccess file and some rewrite rules that allows for script access but not browser access.

What I would to like ask is "How to prevent specific file like xml, jpg to show in browser but it can be use in php/html.

You cannot. For HTML to be able to access anything the client (aka. the browser) must be able to. You see the HTML is rendered on the client, therefore HTML can only access things accessible to the client.

Ok thanks…