【问题标题】:file not uploading after htaccess redirecthtaccess重定向后文件未上传
【发布时间】:2018-06-17 03:08:46
【问题描述】:

所以文件上传最初实际上工作正常,但为了保护我的 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] 

【问题讨论】:

    标签: php ajax .htaccess file-upload


    【解决方案1】:

    您的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]
    

    【讨论】:

      猜你喜欢
      • 2019-07-18
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-02
      相关资源
      最近更新 更多