php - htaccess重定向后文件未上传
问题描述
所以文件上传最初实际上工作正常,但为了保护我的 PHP 文件,我在 htaccess 中重写了 URL,文件上传从此停止......我删除了 htaccess 重定向规则,它又开始工作了。请帮助我,因为我真的需要将实际目录隐藏到我的 PHP 文件中。
javascript ajax 请求
var form = new FormData();
form.append("file_name", file);
AJAX_REQUEST.open("POST", " https://my_site.com/testFile", true);
AJAX_REQUEST.send(form);
.htaccess 文件
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^testFile https:///my_site.com/phps/validateFile.php [NC,L]
解决方案
你RewriteRule
错过了$
吗?
# should this
RewriteRule ^testFile https:///my_site.com/phps/validateFile.php [NC,L]
# be this?
RewriteRule ^testFile$ https:///my_site.com/phps/validateFile.php [NC,L]
推荐阅读
- javascript - 从嵌套对象javascript中删除对象
- tableau-api - 有条件地格式化单元格背景颜色时没有总计
- sql - PL/SQL 因为我在执行对象主体时遇到错误?
- time - 农民需要在 NetLogo 中的离散时间/刻度后更改值
- linux - 守护进程不能关闭使用 DBus 保存的 X11 屏幕吗?
- react-native - firestore 从 react native 中保存可拖动的图像
- faunadb - 从动物数据库获取对象时增加数字?
- javascript - 有没有办法将 vuejs 对象传递给 laravel 控制器?
- java - 在不知道索引的情况下确保分区表上的 SQL 搜索时间为 o(log(n))
- bash - bash 脚本中的间距存在问题