redirect 404 to similar urls

前端 未结 6 944
情深已故
情深已故 2021-01-30 11:16

I have a website with stories in it. I can have multiple types of stories within multiple categories like:

  • children
  • romance
  • scifi
  • action
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 11:54

    Since the values are (presumably) being pulled from MySQL based on the title, you could put a FULLTEXT index on the title column, and use the MySQL MATCH() function to find the most relevant match, and redirect the user to that.

    Although this will be by no means a perfect solution - the type of intelligence required to do this with any real degree of accuracy is veering dangerously close to Turing test territory.

提交回复
热议问题