acidglitter Posted March 23, 2008 Share Posted March 23, 2008 I have this folder on my site for all of my included files like stylesheets and scripts. Is there a way I can protect that folder so no one can view it or any of the files in it in their browser, but my site can still use the files and include them on the main site? Link to comment https://forums.phpfreaks.com/topic/97494-protecting-a-folder/ Share on other sites More sharing options...
wildteen88 Posted March 23, 2008 Share Posted March 23, 2008 If you are including stylesheets into your php script then theres no point in protecting the folder that holds the stylesheet as the user will be able view the css when they go to View > Source To stop people from going a folder and viewing the folder index just add a blank index.html file into the folder, The server will serve index.html file by default. Or turn Indexes of for that folder within the .htaccess file: Options -Indexes The latter may not be possible on some host. Link to comment https://forums.phpfreaks.com/topic/97494-protecting-a-folder/#findComment-498838 Share on other sites More sharing options...
acidglitter Posted March 23, 2008 Author Share Posted March 23, 2008 All I'm including for stylesheets is just: <link rel="stylesheet" type="text/css" href="folder/style.css" /> And I want to be able to prevent someone from typing in that address and viewing any file in that folder. If that makes sense. Link to comment https://forums.phpfreaks.com/topic/97494-protecting-a-folder/#findComment-498841 Share on other sites More sharing options...
wildteen88 Posted March 23, 2008 Share Posted March 23, 2008 Well as the browser requests for that file, then that is the same as typing yoursite.com/folder/style.css within the address bar. There is no simple solution for protecting the css file. The css file and html file all get downloaded to the browsers cache and is parsed to produce what the user displays sees. Link to comment https://forums.phpfreaks.com/topic/97494-protecting-a-folder/#findComment-498845 Share on other sites More sharing options...
acidglitter Posted March 23, 2008 Author Share Posted March 23, 2008 Okay I just won't change anything then. Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/97494-protecting-a-folder/#findComment-498848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.