php - 服务器从 example.html 重定向到 script.php?url=example

标签 php html redirect scripting

我有一个非常复杂的网站需要处理。我正在考虑创建一个包含主要内容(菜单、sidenav、head 等)并为每个页面插入内容的单个“主页”php 文件。我已经将所有页面的内容分开,所以我有一个副本,其中所有 html 文件都只有内部内容(我的意思是没有,没有菜单,除了内容什么都没有)。我想知道是否有办法从任何看起来像 www.site.com/example.html 的链接重定向到 www.site.com/script.php?url=example 。这样,我就可以使用变量来插入内容文件,或者还有其他方法可以做到这一点吗?

最佳答案

不要那样做。这在安全方面是不好的做法。坏人可以指定 url,例如:

www.site.com/script.php?url=../../../etc
www.site.com/script.php?url=www.hackers.com
www.site.com/script.php?url=www.xxx.com

你一定要看看:

关于php - 服务器从 example.html 重定向到 script.php?url=example,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3367574/

相关文章:

php - 中间表的 Eloquent 模型关系

html - WordPress css 加载问题

azure - 连接 Azure CDN 规则变量

ruby-on-rails - 在 RoR : Which one to use out of redirect_to and head :moved_permanently? 中重定向

javascript - 选中任何复选框时如何更改 img 类?

php - 如何设置CMS作为Android应用程序的后端?

html - 表格对齐方式和不同的列宽

php - 使用 PHP 参数重定向 URL

php - 从 Windows 32 位移动到 Linux 64 位,base_convert() 问题

html - 关于 Html 电子邮件通讯的 css 编码标准的困惑