How to do URL re-writing in PHP?

前端 未结 9 2259
死守一世寂寞
死守一世寂寞 2020-11-22 14:38

I am trying to implement URL rewriting in my PHP application. Can someone share a step by step procedure of implementing URL rewriting in PHP and MySQL?

In my applic

9条回答
  •  广开言路
    2020-11-22 15:01

    Sorry about not giving you detailed explanation, but maybe you could take a look at DokuWiki for a starting point.

    In its setup it accepts 3 modes:

    1. Regular urls: ?id=zzz
    2. .htaccess rewrite: uses apache to do the rewritting
    3. internal (php) rewrite: urls end up looking like http://www.example.com/kb/doku.php/start

    It's free so you can just download and browse the code.

    As a note, the apache redirect is very likely the best solution but the pure php one is also interesting in case your code is going to run in IIS6 servers where rewritting is not as easy as in apache.

提交回复
热议问题