Jump to content

Is this a good design? (Database url linkage)


arbitrageur

Recommended Posts

So, built a classifieds site.

 

The link is something like this: mysite.com/category/subcategory/1234

 

The category & subcategory don't do anything, they are just for vanity.

 

My question is about the '1234'. The number corresponds to an "id" which is a unique key in my database.

 

When people make a post, I use LAST_INSERT_ID() to get the most recent post and generate the URL.

 

So basically, my urls correspond 100% to database ID's, for better or worse. These go up by 1 with each post. I anticipate some potential numbering issues when I eventually delete posts.

 

Would it be a better idea to generate these unique IDs some other way, or is this acceptable design?

 

Thanks.

Edited by arbitrageur
Link to comment
Share on other sites

It's pretty standard design.

Also, don't underestimate the words "category', "subcategory", etc.  Use words people can remember and that search engines (or at least search engine users) can understand.

 

What "potential numbering issues" do you anticipate?  When we remove a product at OMBE, we just serve a 410 or 404, as appropriate.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.