Remove file extensions without using .htaccess

ぃ、小莉子 提交于 2019-12-19 12:11:05

问题


Is there a way of removing file extensions from my URLs without using .htaccess?

Like if my URL is http://example.com/index.html, can I make it http://example.com/index without using .htaccess?

The reason I ask is because I do not have access to the .htaccess file.


回答1:


It is possible and widely covered here. I will not copy paste whole article here.

You can also have urls like

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']; Remember to validate/filter the PATH_INFO and all other request variables before using them in your application.



来源:https://stackoverflow.com/questions/41806732/remove-file-extensions-without-using-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!