使 PHP GET 参数看起来像目录 [英] Making PHP GET parameters look like directories
本文介绍了使 PHP GET 参数看起来像目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在努力做到这一点:
I am trying to make it so:
http://foo.foo/?parameter=value
转换"为http://foo.foo/value
谢谢.
推荐答案
假设您在 Apache 上运行,.htaccess 中的这段代码对我有用:
Assuming you're running on Apache, this code in .htaccess works for me:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)/$ /index.php?parameter=$1
根据您的网站结构,您可能需要添加一些规则.
Depending on your site structure you may have to ad a few rules though.
这篇关于使 PHP GET 参数看起来像目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文