如何制作虚拟目录?
http://wiki.answers.com/Q/What_do_the_abbreviations_mean_on_an_ultrasound_scan
在上面的网址中,它看起来像“ What_do_the_abbreviations_mean_on_an_ultrasound_scan”是一个目录!但我认为它是一个虚拟目录!
我想了解这个东西!!如何做这些事情以及它们的名称???
http://wiki.answers.com/Q/What_do_the_abbreviations_mean_on_an_ultrasound_scan
In above url, it looks like "What_do_the_abbreviations_mean_on_an_ultrasound_scan" is a directory!! but i think its a virtual directory !!
I want to know about this stuff !! how to do these things and what they call ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
他们很可能使用 mod_rewrite 来重写 URL。 StackOverflow 上 mod_rewrite 的 tag wiki 是一个很好的资源。
mod_rewrite 的规则存储在 .htaccess 文件中,看起来像这样:
这会将所有与以
/Q/
开头的 url 匹配的请求重写为answers.php,并提供后面的内容 (在本例中,What_do_the_abbreviations_mean_on_an_ultrasound_scan
)作为 GET 参数。如果运行 PHP,则可以在脚本中通过$_GET['slug']
访问该内容。They are most probably using mod_rewrite to rewrite the url. A good resource is the tag wiki for mod_rewrite here on StackOverflow.
The rules for mod_rewrite is stored in the .htaccess file, and looks something like this:
This would rewrite all requests whitch match a url starting with
/Q/
to answers.php, and provide whatever is after (in this caseWhat_do_the_abbreviations_mean_on_an_ultrasound_scan
) as a GET parameter. This would be accessible in the script as$_GET['slug']
if they were running PHP.