我想要所有的疑问
http://mysite.com/something/otherthing?foo=bar&x=y
Run Code Online (Sandbox Code Playgroud)
被重写为
http://mysite.com/something/otherthing.php?foo=bar&x=y
Run Code Online (Sandbox Code Playgroud)
换句话说,只需将.php扩展名设为可选的.
我正在寻找一种通过.htaccess隐藏文件扩展名并拒绝直接访问的方法.我们考虑以下几点:
http://www.xyz.zyx/index.php
Run Code Online (Sandbox Code Playgroud)
转换为
http://www.xyz.zyx/index OR http://www.xyz.zyx/
Run Code Online (Sandbox Code Playgroud)
一切都好到现在为止.我想要做的是在用户尝试直接访问时阻止或重定向.例如,如果用户在URL栏中键入以下(扩展名),阻止或重定向:
http://www.xyz.zyx/index.php
Run Code Online (Sandbox Code Playgroud)
我从其他问题中检查了其他答案,但似乎并非如此.
在此先感谢帮助像我这样的新手.