不使用 .htaccess 删除文件扩展名 [英] Remove file extensions without using .htaccess
问题描述
有没有办法在不使用 .htaccess 的情况下从我的 URL 中删除文件扩展名?
Is there a way of removing file extensions from my URLs without using .htaccess?
如果我的网址是 http://example.com/index.html,我可以在不使用 .htaccess 的情况下 http://example.com/index?
Like if my URL is http://example.com/index.html, can I make it http://example.com/index without using .htaccess?
我问的原因是因为我无权访问 .htaccess 文件.
The reason I ask is because I do not have access to the .htaccess file.
推荐答案
这是可能的并且被广泛覆盖 这里.我不会在这里复制粘贴整篇文章.
It is possible and widely covered here. I will not copy paste whole article here.
你也可以有像
http://example.com/index.php/your/fancy/urlPHP5 开箱即用.然后,您可以使用
http://example.com/index.php/your/fancy/url out of the box with PHP5. You can then read the URL parameters using
echo $_SERVER['PATH_INFO'];请记住在您的应用程序中使用它们之前验证/过滤 PATH_INFO 和所有其他请求变量.
echo $_SERVER['PATH_INFO']; Remember to validate/filter the PATH_INFO and all other request variables before using them in your application.
这篇关于不使用 .htaccess 删除文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!