Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Structure

Status
Not open for further replies.

ralphiooo

Programmer
Oct 23, 2005
64
GB
Hi, i'm creating a simple cms system to manage a small site. The problem I'm having is getting the url structure to work with the site. I thought I would post here as many of you users i'm sure would have encountered similar problems. I will take you through each step I made while encountering problems. First I had:

/section/cat-name-id/
/section/cat-name-id/page-title-id/
/section/page-title-id/

I then needed a multiple page system so I could display comments and it changed further to:

/section/cat-name-id/
/section/cat-name-id/page/
/section/cat-name-id/page-title-id/
/section/cat-name-id/page-title-id/page/
/section/page-title-id/
/section/page-title-id/page/

My problem lies that I wish to have pages in the root and there is no way to distinguish between a category and a page so I next went for:

/section/cat-name-id/
/section/cat-name-id/page/
/section/cat-name-id/page-title-id.htm
/section/cat-name-id/page-title-id/page.htm
/section/page-title-id.htm
/section/page-title-id/page.htm

But it's not the best solution in terms of usability (1 because it has the id in the titles and I can't see how I can get rid of this - although I've seen other CMS systems to this and would appreciate if someone could share how). The second problem is not as serious but still an issue I feel, say if a user gets rid of the page.htm part then it would read /section/page-title-id/ or /section/cat-name-id/page-title-id/ and this would not work.

Appreciate if anyone has a better solution. Thanks
 
instead of browsing to each subdirectory of the site, why don't you have the site hanging off the index.php page and just include() those other files as you need (perhaps based on a query string).

 
Yeah that's what I'll be doing but I'm going to use a url rewrite to make it more search engine friendly.
 
I am a little confused by your question, and probably should not answer until I've had more coffee...but it seems to me that to deal with your second problem:
ralphiooo said:
...say if a user gets rid of the page.htm part then it would read /section/page-title-id/ or /section/cat-name-id/page-title-id/ and this would not work.
You will need to decide on a standard URL structure; instead of having the second 'level' possibly representing three different things they all need to represent the same thing; for this example: 'cat-name-id'. Then at each level there will need to be some sort of default page, so that if a URL is sent containing only two 'levels' you will know that the user is requesting the 'cat-name-id' table of contents (or whatever).

As for your first problem:
ralphiooo said:
because it has the id in the titles and I can't see how I can get rid of this - although I've seen other CMS systems to this and would appreciate if someone could share how
The only thing I can think of is to programmatically ensure all 'titles' of a level are unique, so that the title is the id.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top