search

Home  >  Q&A  >  body text

nginx rewrite does not take effect when written

I need to put

/module/index.html#/

Turn into

/index#/

No need for the previous module

/module/merchant.html#/

Turn into

/merchant#/

I write

rewrite ^/module/index.html(.*)$ /index#/;

Direct 404b

过去多啦不再A梦过去多啦不再A梦2706 days ago1002

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-07-03 11:45:09

    #The data behind is processed by the HTML page, not by routing, so your rewriting rules should be:

    rewrite ^/module/(.+)\.html$ /

    That’s it.

    All you need to do is remove .html and /module/.

    In addition, I don’t know whether you want to write the address /module/index.html to access /index, or write the address /index to access /module/index.html, if it’s the latter , it’s not the one above, it should be:

    rewrite ^/(.+)$ /module/.html

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-07-03 11:45:09

    Sorry, the server cannot get the data after # of URL. This part can only be processed on the front end.

    reply
    0
  • Cancelreply