This is a discussion on URL Parsing on Apache or IIS within the PHP Language forums, part of the PHP Programming Forums category; I am coming up with a new site, which will be community-driven and subscription-based. I would like for ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am coming up with a new site, which will be community-driven and
subscription-based. I would like for people to go ato a URL that is friendly and easy to remember. Let's say my domain is mydom.com. I am a new user who just registered newsite as my name. I want to load a PHP file, but call it something other than - say - default.php. In other words, I want to load a pagedefault.php file which will pull information from a database based on the user's name. There are not going to be user directories. (The user will have no ability to upload using FTP.) As I currently see it, I can do something like: http://www.mydom.com/default.php?username=newsite What I'd like to do is something like: http://www.mydom.com/newsite/default.htm on the address bar of the browser. This will be parsed into the correct parameter (username=newsite) and the correct page (default.php) will be loaded. I noticed one semi-related item here from a bit ago.. www.webmasterworld.com/forum88/421.htm This forum post describes the use of MOD_REWRITE. Ideas? Kai www.perfectreign.com - The Project Management Site |
|
|||
|
On Wed, 02 Jun 2004 13:09:24 -0700, filesiteguy <abuse@127.0.0.1> wrote:
>As I currently see it, I can do something like: >http://www.mydom.com/default.php?username=newsite > >What I'd like to do is something like: >http://www.mydom.com/newsite/default.htm on the address bar of the >browser. This will be parsed into the correct parameter >(username=newsite) and the correct page (default.php) will be loaded. >I noticed one semi-related item here from a bit ago.. > >www.webmasterworld.com/forum88/421.htm Can't see it, need to register. >This forum post describes the use of MOD_REWRITE. I agree, use mod_rewrite. -- Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space |
|
|||
|
filesiteguy wrote:
> I am coming up with a new site, which will be community-driven and > subscription-based. I would like for people to go ato a URL that is > friendly and easy to remember. Commendable, old boy. Persistency is another consideration. But I bet you've already thought of that and filed it under "friendly". Non-persistent URIs are surely unfriendly. [ ... ] > As I currently see it, I can do something like: > http://www.mydom.com/default.php?username=newsite > > What I'd like to do is something like: > http://www.mydom.com/newsite/default.htm on the address bar of the > browser. Good, that's definitely better; yet it could be improved upon. Why is "default.htm" tacked on the end? I don't like it. Firstly, "default" isn't very descriptive. What information can a user gain from that part of the URI? Secondly, going back to the persistency principle, will your file still be HTML ten years down the line? Get rid of ".htm" too. Make it work with or without the www subdomain and the trailing slash, but be cache-friendly by being consistent with what you publish. What constraints are placed on site names? E.g., length, case, characters allowed, etc. [ ... ] > This forum post describes the use of MOD_REWRITE. See also <http://httpd.apache.org/docs/misc/rewriteguide.html>. -- Jock |