如何在PHP站点上制作类似文件的URL?
问题描述:
I have a site with a few PHP files responsible for showing all of the context. All of the URLs I have look like ...page.php?id=###
. Is it possible to assign some path to each id
so that a visitor thinks that he is visiting static files?
我有一个网站,其中有几个PHP文件负责显示所有上下文。 我看起来像 ... page.php?id = ### code>的所有网址。 是否可以为每个
id code>分配一些路径,以便访问者认为他正在访问静态文件? p>
div>
答
You can do this through the mod_rewrite
in apache.
This generator might come in handy
答
Yes, the easiest way is to use a path like page.php/id/how-to-make-file-like-urls-on-php-site
and parse$_SERVER['PATH_INFO']
in your script.