Change URL Address make short in PHP

一笑奈何 提交于 2019-11-28 01:11:18

问题


I have Url as:

localhost/ab/directory.php?id=200

id=200 is jenny id member

how to change it to

localhost/ab/jenny

is possible?

Thanks


回答1:


You'll want to use mod_rewrite, a module available in apache. This will be managed by an .htaccess file within your web directory. AddedBytes has a nice tutorial for beginners on url-rewriting.

See: http://www.addedbytes.com/for-beginners/url-rewriting-for-beginners/




回答2:


See: http://www.addedbytes.com/for-beginners/url-rewriting-for-beginners/




回答3:


You can do this in at least 2 different ways:

  • Use mod_rewrite for Apache to map the SEO friendly URL to your querystring based URL.
  • Make /ab a php script that inspects the PATH_INFO to retrieve /jenny. You'll have to configure Apache to treat scripts with no extension as php scripts for this to work.



回答4:


Check This: http://www.wmtips.com/apache/how-use-mod-rewrite-url-rewriting.htm



来源:https://stackoverflow.com/questions/1885993/change-url-address-make-short-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!