URL rewrite with .htaccess make duplicate mysql entries

后端 未结 2 1740
盖世英雄少女心
盖世英雄少女心 2020-12-19 13:22

If rewrite url with .htaccess, all INSERT query with php is performed twice (unwanted duplication)

My .htaccess:



        
相关标签:
2条回答
  • 2020-12-19 13:32

    Additionally you can set a primary or unique key in your SQL table (for example, 'title'). That alone would prevent any duplicate entries.

    0 讨论(0)
  • 2020-12-19 13:57

    Browsers automatically request the favicon.ico file by default.
    But you don't have any favicon.ico file so it is rewritten (rule in your htaccess).
    This is why you have a duplicate execute.

    Solutions:

    1. Add a favicon.ico file
    2. Don't INSERT (in index.php) if url requested is favicon
    3. Disallow it in your htaccess with a rule
    0 讨论(0)
提交回复
热议问题