【发布时间】:2014-09-20 17:47:58
【问题描述】:
当 URL 未指定文件时,如何让我的网站加载特定文件?
如果有帮助,我也会使用 WAMP...
例如... 当用户访问http://mywebsite.com/magicpage/thispage/lmao 我希望用户加载 HTML 文件 somefile.html
【问题讨论】:
-
apache : DirectoryIndex 将文件设置为仅在指定目录时显示。
-
完美,有没有保留完整的 url 请求?现在我已经这样做了...访问mywebsite.com/products/supertoy/newtoy 我希望它重定向以在 URL 栏中显示 url mywebsite.com/products/supertoy/newtoy,但显示 products.html 页面...
-
是目录中的文件吗? doc_root/products/supertoy/newtoy/products.html 您是否希望将该请求重写到不在 url 指定的目录中的不同页面(产品)。您需要查看 url 重写您的问题有点不清楚
-
products.html 在 doc_root/products/ 我只想在 URl 中有 supertoy/newtoy 以便我可以提取这些值
-
所以你真正想要的是使用mod_rewrite,并在内部重写url以便显示产品页面,并且产品页面可以使用url值做一些事情有大量的使用示例mod_rewrite 这样做
标签: php html apache wamp wampserver