hugh90 Posted August 11, 2006 Share Posted August 11, 2006 My site is in .phpHow do you stop from raw files showing? The files of my site show up if I (for example) go to www.site.com/folder/folder. How do I prevent this situation so the raw files doesn't show up?Most sites when you go to www.site.com/folder/folder you end up on a normal webpage, but mine shows the raw files. :(Some sites stop this from happening to their site and protect it, can you please tell me how to stop it too?I'm a newbie. :|Thanks :) Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/ Share on other sites More sharing options...
mainewoods Posted August 11, 2006 Share Posted August 11, 2006 just add a file called index.htm to that directory and then it will just show that file and that file can have a meta-refresh in it to go elsewhere. Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73147 Share on other sites More sharing options...
hugh90 Posted August 11, 2006 Author Share Posted August 11, 2006 [quote author=mainewoods link=topic=103870.msg413950#msg413950 date=1155311340]just add a file called index.htm to that directory and then it will just show that file and that file can have a meta-refresh in it to go elsewhere.[/quote]So that means adding an index.htm manually in every folder/directory? Isn't there a way that can stop this at once? A quick fix code or the way to url my php’s so that it is permanently stable without manually adding an index.htm with every folder. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73151 Share on other sites More sharing options...
mainewoods Posted August 11, 2006 Share Posted August 11, 2006 you may be able to add a .htaccess file to your top directory that would solve the problem, I'm not sure of the syntax though. Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73160 Share on other sites More sharing options...
mainewoods Posted August 11, 2006 Share Posted August 11, 2006 http://www.javascriptkit.com/howto/htaccess11.shtml Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73165 Share on other sites More sharing options...
hugh90 Posted August 11, 2006 Author Share Posted August 11, 2006 Hi thanks i've added it, and it works but it just shows the same Directory Listing but without my raw files (which is a good thing) But it looks very unprofessional, so how can I completely stop the Directory Listing page from showing, hopfully with an error page or a redirect back to the main page. Can this be achieved through .htaccess? Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73170 Share on other sites More sharing options...
mainewoods Posted August 11, 2006 Share Posted August 11, 2006 potentially through the mod_rewrite feature of .htaccess which is a complicated subject and I can't help you with that. Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73181 Share on other sites More sharing options...
simcoweb Posted August 11, 2006 Share Posted August 11, 2006 Truthfully the best way is to put an index.htm file in each one ( or index.shtml, index.php, index.html.. it just needs to be an index file) since doing via .htaccess just puts more strain on the server everytime someone attempts to hit one of your folders. Or you can pick up a little utility that not only prevents them from viewing your unprotected folders but logs their IP, redirects them to the page of your choice, and allows you to ban IP's if needed. Check out:[url=http://www.templatedepot.com/snoop-catcher.htm]http://www.templatedepot.com/snoop-catcher.htm[/url] Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73203 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 I would make directory listings unavailable where it would generate uhhh 403 (?) errors... then you could just use an appropriate error document... Possibly having it redirct the user to /index Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73207 Share on other sites More sharing options...
hugh90 Posted August 11, 2006 Author Share Posted August 11, 2006 [quote author=corbin link=topic=103870.msg414015#msg414015 date=1155317250]I would make directory listings unavailable where it would generate uhhh 403 (?) errors... then you could just use an appropriate error document... Possibly having it redirct the user to /index[/quote]Yeah but how would I do this? I don't know, can you please explain how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73306 Share on other sites More sharing options...
simcoweb Posted August 11, 2006 Share Posted August 11, 2006 It's not that hard.1. create a custom error page ( I make mine look like the rest of the site with menus and everything. Like this: http://www.templatedepot.com/no-page-here.htm )2. edit your .htaccess file with this:ErrorDocument 403 http://www.yoursite.com/403.htmErrorDocument 404 http://www.yoursite.com/404.htmErrorDocument 500 http://www.yoursite.com/500.htmThose are the most common errors. Quote Link to comment https://forums.phpfreaks.com/topic/17250-how-do-you-prevent-a-site-from-being-exposed/#findComment-73311 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.