Look into mod_rewrite with .htaccess.
Printable View
Look into mod_rewrite with .htaccess.
My server doesn't allow .htaccess .... Thanks anyway though :p
At that point, (and even with the php), really... why?
It's not worth it for this.
There are easier ways, and redirecting the browser, even using headers, can't be good practice for no reason.
It's a cool idea... but you're just making extra work for yourself :)
The arrays, and for-loops were good PHP practice for me anyway :)
Sorry, I only saw the first page!!!
Then ask about it. :) I can't help people understand something if they never say that there's a problem in the first place.Quote:
Originally Posted by mburt
By the way, you're in for a pleasant surprise, later.
A Uniform Resource Identifier. URIs are a superset of URLs (Uniform Resource Locator) and URNs (Uniform Resource Name). That is, all URLs are URIs.Quote:
What's a URI?
A Locator not only identifies a resource, but also indicated how to access it by specifying its location (for example, its network address)
Again (I mentioned this in the thread I cited), the URI for such a thing would end in a slash:Quote:
Originally Posted by djr33
  http://www.example.com/guestbook/
Using a separate directory for every single document isn't practical.
Thankfully, and here's the surprise, it doesn't need to. In your case, it would seem that the MultiViews option (one of the content negotiation mechanisms I discussed) is already enabled.Quote:
Originally Posted by mburt
Just as a random example, consider your Basic Calendar script (you misspelt the heading, by the way). The URL for that ends:
  /scripts/basic_calendar_root.htm
However, it can also be accessed using:
  /scripts/basic_calendar_root
Why? When the request is received, no file, redirect rule, or anything else is found. However, because MultiViews is enabled, the server searches for files that begin with that name. When it finds basic_calendar_root.htm, it checks to see what type it is (text/html), and whether the browser making the request will accept it (it will). As a result, it returns that same file.
If there are multiple matches, the server negotiates between them, finding the best match for the client based on language, encoding, type, etc. This allows for multiple representations that vary based on filename, using the name to distinguish one from another (for example: index.html.en, text/html, English; index.html.fr, text/html, French).
The same thing can apply to your PHP files (assuming that they really need to be PHP, now): /resources.php can be accessed as /resources.
Unfortunately, your host has configured PHP in the unfriendly way by MIME type, rather than handler, but it shouldn't be a problem. Moreover, with scripts.php, using the URL ending /scripts would result in a redirect to the directory with the same name. You'd either have to change the directory name or place an index file in that directory.
Mike
Holy crap... how did that happen? When you type in the url for mburt.mb.funpic.org/resources, it automatically went there... you're a complete genius. The process of this did advance my PHP a little more though. But again, thanks for all the help :)
You're host enabled the MultiViews option. It's actually part of the default configuration for user directories (http://www.example.com/~username/). Either that directory structure is used internally, or they enabled it for all virtual hosts.Quote:
Originally Posted by mburt
I thought I'd give it a shot and tried it. :cool:
By the way, you might want to re-read the last paragraph of my post as you might have been reading it whilst I was editing.
Mike
Yes, I changed scripts.php to scripts_page.php. I realized it was already a directory, and that it would take me to the index of the directory. Thanks.
Construct the page in html and then use this and change/add to your taste:
Whatever you save this as is what they will be. If you save this script as "index.php", you will have "index.php?about", "index.php?rules", "index.php?join", etc.PHP Code:<?php
//Copy and paste the HTML that is the same in all your pages (the header and footer) into new files and name them header.inc and footer.inc.
//They will be included at the complete top and bottom of your pages, so you will only have to edit these 2 files if you want to change your layout.
include('header.inc');
if(!$_SERVER['QUERY_STRING']) { ?>
//Paste here the HTML coding you have on your main page. This is what people will see when they go to index.php, without any ?section bit after it.
<? } elseif ($_SERVER['QUERY_STRING'] == "about") { ?>
//Paste here your HTML code on the About page (without the header and footer code, obviously).
<? } elseif ($_SERVER['QUERY_STRING'] == "rules") { ?>
//Paste here your HTML code on the Rules page (without the header and footer code, obviously).
<? } elseif ($_SERVER['QUERY_STRING'] == "join") { ?>
//Paste here your HTML code on the Join page (without the header and footer code, obviously).
<? } elseif ($_SERVER['QUERY_STRING'] == "codes") { ?>
//Paste here your HTML code on the Codes page (without the header and footer code, obviously).
<? } elseif ($_SERVER['QUERY_STRING'] == "members") { ?>
//Paste here your HTML code on the Members page (without the header and footer code, obviously).
<? } elseif ($_SERVER['QUERY_STRING'] == "extra") { ?>
//Paste here your HTML code on the Extra page (without the header and footer code, obviously).
<? }
include('footer.inc'); ?>
You can also change some of the code to make it so it is like "index.php?act=about" by doing the following:
"elseif ($_SERVER['QUERY_STRING']" or "if(!$_SERVER['QUERY_STRING']" can be changed by replacing "SERVER" with "GET" and "QUERY_STRING" to what you want it to be after the "?"...
e.g.
($_GET['act'] == "about") on "index.php" will make the url appear as "index.php?act=about"
On forum boards like this they do that... this page is "showthread.php?t=14133", they used "t" as "thread"