How to identify if referrer is a 301 redirect

前端 未结 5 1552
悲&欢浪女
悲&欢浪女 2020-12-21 15:46

I\'m implementing a slug system for my website at the moment. I plan to redirect invalid slugs to the correct on that is stored in the database. E.g.

5条回答
  •  旧巷少年郎
    2020-12-21 16:22

    Alternatively you could append a GET parameter to your url (if you don't mind that), and check for it in your PHP script. Something like:

    http://example.com/11/right-slug?corrected-from=http://example.com/11/wrong-slug
    

    On the same note you can use the session or cookies, but you must take care to remove them after detection.

提交回复
热议问题