问题
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