Lilium Posted June 23, 2008 Posted June 23, 2008 I was wondering, how do you code a website that has sections. What I mean by sections is like this: http://www.helionet.org/index/index I want to have a page that doesn't have to end in .html but still it should be a page. I know I sound a bit confusing but if someone could help me I'd be grateful.
meriadoc Posted June 23, 2008 Posted June 23, 2008 I'm having a difficult time understanding your question completely. All files need to have an extension so that the server and browser know how to interpret that particular file. If you are talking about breaking your site down into an organized set of directories or folders then I've found it best to use relative paths rather than complete paths. Using relative paths make it easier to move things around and adjust as the site grows. If I didn't come close to answering your question, maybe you can give an example of what you are trying to do.
Wizard Posted June 23, 2008 Posted June 23, 2008 I think Lilium is talking about how sometimes you can just punch in a directory i.e. foo.com/bar, and still get a html page. Or when you 404 on a site, they give you a customized 404 instead of your browser giving you the standard. I've wondered about that myself, but I haven't tried out anything yet. I think if you put an index page in any directory, the browser will automatically go to that page, but the url display will only show the directory. It works in theory anyways.
Sungazer Posted June 23, 2008 Posted June 23, 2008 i believe i know what he means, and yes all files need to have an extension. the only trick i can think of to bypass that would be when you first load into a default page it only shows the directory... example: i have a main page w/ link that points to directory on the website say /games... in that directory you have a default .aspx/.html/.whatever... when that default page loads it would show this in the address bar: http://www.yourpage.com/games/ edit: lol and wizard beats me to it :-P
meriadoc Posted June 24, 2008 Posted June 24, 2008 Ahh yes, now I see what you are getting at. This is handled by the DirectoryIndex and DirectorySlash directive with Apache Module mod_dir. As Wizard and Sungazer stated there are defaults setup in the main configuration file that tell the server what files to look for when a directory is entered. You would need to ask Heliohost for the default settings. Normally it is index.html and index.html.var. I would venture to guess that this has been expanded to include index.htm, index.php, default.aspx and possibly a few others. Provided overrides are permitted in the main configuration you can add a .htaccess file with a directive to point to files other than the default configuration.
Lilium Posted June 24, 2008 Author Posted June 24, 2008 Wow great replies guys! I've posted this same topic in other websites I've been and your replies have been most helpful! Thanks again!
Wizard Posted June 24, 2008 Posted June 24, 2008 Look up mod_rewrite *pours over Apache documentation* How would we utilize this? It looks like there are no config files for Apache in my /home. >>The Wizard is Confounded.<< Edit: Oh wait... is it through .htaccess? Means we have to make these ourselves.
meriadoc Posted June 25, 2008 Posted June 25, 2008 Yes, the .htaccess file allows you to customize your configuration by directory. Any directives that you place a .htaccess file will also apply to subdirectories of the directory it is placed in. In most cases the main configuration of apache is enough to satisfy your needs. .htaccess files come into play when you want to do something a little different.
mikeloyst Posted July 9, 2008 Posted July 9, 2008 In the case of helionet.org/index, that would simply be a sub-directory with an index.html, index.php or default.php file in it. If you want to make your website do this, simply create a directory for every page rather than a seperate HTML file. this would be the option, however it is very time consuming. I feel that the best and easiest way to design a fully functional website with seamless integration with services like openID, Windows Live and Facebook, you should look into an open source CMS (Content Management system) Called drupal. http://drupal.org It works like this. You upload the files to your website, extract them, and navigate to that directory. The system guides you through the installation and database setup, and gives you a feature to give every page a clean URL. A clean URL basically masks the extension and gets rid of any nasty ?a= variables. Example: www.example.com/?q=page/services&hl=en Would turn out like this: www.example.com/page/services/en This gives the appearance of multiple directories when it is a single php file returning database fields to display the different content. If you need any help, or send me a message. Look up mod_rewrite *pours over Apache documentation* How would we utilize this? It looks like there are no config files for Apache in my /home. >>The Wizard is Confounded.<< Edit: Oh wait... is it through .htaccess? Means we have to make these ourselves. There should already be a .htaccess in your public_html directory. Just make sure that you have enabled cpanel to show hidden files
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now