Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6327419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:16:36+00:00 2026-05-24T17:16:36+00:00

I want to ask you for best solution for the router. I have some

  • 0

I want to ask you for best solution for the router.

I have some tables in my database (articles, pages, categories etc.) which all has IDs.
I want to generate specific URL for each of them, eg. /en/article/25-This-is-an-test-article.

But how to get rid of that /article, /page, … ? Users don’t want to see it – it just increases the length of url …

My first idea was simple router table:

CREATE TABLE `router` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `entity_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

But there is one fatal problem – It’s impossible to set foreign key for the enitity_id column because it should refer to more columns and that is not possible in SQL.

My question is:
Do you think that I should stick with that solution (and ignore the foreign key )
or should I forgt about it and append the type in the URL ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:16:37+00:00Added an answer on May 24, 2026 at 5:16 pm

    I want /en/article/55-something to become /en/55-something – with
    the best performance, with the best and cleanest way (the problem is
    WHERE and HOW to save the info that 55-something IS an article, not
    the page)

    The best place for that information is right there in the URL, so that you don’t have to muck about with flimsy, best-guess lookups.

    Short answer: you’re already doing it properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to ask which is best library to manipulate excel sheets from C#
I want to ask that If have read that it is possible to give
I want to ask a question about the best way to reload activity when
I want to ask you about best rails way to create a menu. I
At the risk of being downmodded, I want to ask what the best mechanism
just want to ask what would be the best way to hide sensitive data
want to ask user to input something but not want to wait forever. There
I want to ask you something. I make the application web with the Google
I want to ask about an edge-case scenario that I understand is very poor
I want to ask pro developers out there that how they manage a big

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.