相关疑难解决方法(0)

使用mod_rewrite RewriteRule重写所有查询以不需要.php扩展名

我想要所有的疑问

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扩展名设为可选的.

php url mod-rewrite friendly-url

6
推荐指数
1
解决办法
1727
查看次数

重写文件扩展名但拒绝直接访问文件

我正在寻找一种通过.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)

我从其他问题中检查了其他答案,但似乎并非如此.

在此先感谢帮助像我这样的新手.

php security rewrite hide

5
推荐指数
1
解决办法
2274
查看次数

标签 统计

php ×2

friendly-url ×1

hide ×1

mod-rewrite ×1

rewrite ×1

security ×1

url ×1