CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   What do you do with empty directories? (http://www.codingforums.com/showthread.php?t=283749)

listerdl 12-07-2012 02:39 PM

What do you do with empty directories?
 
What I mean is - I have some paths that are like this:

my-site.com/folder/content.html

But the /folder/ has no content. I know that I can add an index.html file there but is there a way redirect users away from looking in an empty folder?

I guess .301 htaccess can do that as can a javascript redirect - but is there a third way? Just wondering what you guys would do.....

Rowsdower! 12-07-2012 05:00 PM

If you don't want to have to create an index file in each directory then htaccess is really your best (and perhaps only) option.

You can either set a redirect/rewrite to a page that does exist (which, from your question, I assume you know how to do already) or you can specify your default index page so that users can still visit /folder/ and they will see your content.html page.

Setting the default index page to be your contents.html file would look something like this:

Code:

DirectoryIndex content.html

listerdl 12-09-2012 11:36 PM

Thanks - appreciate your help. I was just curious to see what other people do


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.