我正在开发一个私人项目,该项目基本上是一个配置文件系统。现在我一直在尝试如何改进 URL 格式。
目前,我正在使用如下所示的 URL:
-> http://example.com/overview
-> http://example.com/profile/?name=foo
-> http://example.com/jobs/?name=foo
overview 和 profile 都是我网站上的目录,其中包含一个 index.php 文件,其中包含应该从数据库中检索的 PageID。
现在,我的目标是将 URL 格式化为:
-> http://example.com/foo或http://example.com/profile/foo
-> http://example.com/foo/jobs或http://example.com/profile/foo/jobs
有没有办法用 MOD_REWRITE 做到这一点?
这意味着原始 url 看起来像http://example.com/?character=foo/jobs,即http://example.com/get_var/directory。
我已经对 Stackoverflow 和 Google 进行了研究,搜索“ mod_rewrite get variables ”。但似乎没有什么是我希望看到的。
此致,
Larssy1