How to do URL re-writing in PHP?

前端 未结 9 2207
死守一世寂寞
死守一世寂寞 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条回答
  •  萌比男神i
    2020-11-22 15:01

    After reading comments and question once again, I've realized that my previous answer is not completely the thing your are looking for. So here some additions, if you want rewrite/redirect/proxy the URL addresses so for example then user types www.f1.com he will actually see www.f2.com, but domain will remain the same, you probably need to setup a reverse proxy using Apache for that. It act's similar to mod_rewrite.

    Regarding the second part, since modern crawler also performing the URL link analyses I think your first option is better performance wise.

    Previous answer:
    And using PHP you can achieve redirection like:

    
    

    From php.net. Here more examples.

提交回复
热议问题