问题
I have the following URLs:
http://website.com/folder1/file.php
http://website.com/folder2/file.html
I want to know if there is any way in PHP that will let me hide the files and their extensions so the URLs will look like this:
http://website.com/folder1/
http://website.com/folder2/
I know this is possible using htaccess and mod_rewrite but I want to do it using PHP only.
回答1:
ok I found the answer :
<? echo dirname("http://website.com/folder1/file.php"); ?>
so the url will look like this :
http://website.com/folder1/
来源:https://stackoverflow.com/questions/31493950/getting-rid-of-files-from-domain-name-using-php