My index.html file resides in a folder called main. When I want browse to my site I must append a /main at the end of the URL. Is there a way around this? I thank you in advance for help.
jantom
My index.html file resides in a folder called main. When I want browse to my site I must append a /main at the end of the URL. Is there a way around this? I thank you in advance for help.
jantom
You should be able to change which directory is used as the root directory in your cPanel. This is only if I remember correctly. You can with most hosts.
Or you can use a meta redirect in a html file in your root directory to forward any visitor, or yourself, on to the sub-folder. I forget the proper meta syntax in the header. You could just google meta redirect and find it pretty easily.
Last edited by GrandeMike; 03-20-2009 at 10:26 PM.
The Grande-est of them all!
Put this line in your .htaccess:
DirectoryIndex /main/
█ Neil Hanlon | x10Hosting Support Representative
█ Neil[at]x10hosting.com
█ I'm always happy to help. Just ask a question in Free Hosting
█ Terms of Service IRC
Thx leafypiggy. I added the line of code to the bottom of the .htaccesss file (which i learned is a hidden file.) Now when i try to browse to my site i receive a "500 internal server error" with an additional "404 not found error while trying to use error document to handle request" error. What do i do now. thx.
Last edited by jantom; 03-22-2009 at 10:38 AM.
You will have to use an ftp client like FileZilla to see hidden (or dot files)
Just use your cPanel info to connect to the server. If all else fails, create the file locally on your computer, and just use cPanel to upload it.
█ Neil Hanlon | x10Hosting Support Representative
█ Neil[at]x10hosting.com
█ I'm always happy to help. Just ask a question in Free Hosting
█ Terms of Service IRC
I'd be very surprised if leafypiggy's approach worked. By setting DirectoryIndex in .htaccess for DOCUMENT_ROOT, anytime a user requested a URL that resolved to a directory, Apache would serve up DOCUMENT_ROOT/main/. If a user requested "/foo/bar/" zhe'd get "/main/". Moreover, Apache would no longer look for index.html when resolving a directory URI. I'm guessing this last fact is part of why you're getting to 500 error. All of the preceding doesn't apply when DirectoryIndex is set for a subfolder.
You can use an external redirect, as GrandeMike suggests, or you can use rewrites (if you don't like that guide, Google will turn up plenty of others).
I have to ask: why did you organize your site that way?
Thx for your reply. I'm not sure what u meant by why did i organize the site this way. The folder structure is what was presented to me when I logged into cpanel. I added the CSS folder to hold my style file(s) and the image folder to hold site image(s). The folder "main" was actualy named "jantom" which is my account name. I don't know why that is. I renamed it to "main". As of now, I totally fobar'd. I did try leaftpiggy suggestion and it didn't work and to make matters worse i believe i deleted a .htaccess file. How can i wipe the slate clean and start over? The site was in it's development infancy so i'm not losing anything except time as of now.
I don't really understand what you did but, try doing a restore (cpanel->r1soft restore backups) to the earliest date. Hopefully this will put it back into a working state.
Last edited by garrettroyce; 03-25-2009 at 12:09 PM.
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
I was wondering why you had your entry page in /main/ rather than /. Site organization mostly involves what URLs access which pages (and thus where files are stored on disc), what content is on which page and how the pages link to each other; it was the first category I was referring to when I asked the question.
And all of these are under public_html? In that case, it'd probably be better to do away with /main and place index.html in DOCUMENT_ROOT. That's both a more standard and conceptually sound approach.
garrettroyce's suggestion should work for restoring your site. If not, I'll post a sample .htaccess that should work for you.
Last edited by misson; 03-25-2009 at 09:06 PM.
or another way would be to move main and all other folders you need out of the existing public_html folder. Then delete that folder and rename /main to public_html which would make main your root. then move any other folders back into public html. No need for redirects.