<legend id='6mPBs'><style id='6mPBs'><dir id='6mPBs'><q id='6mPBs'></q></dir></style></legend>

    <tfoot id='6mPBs'></tfoot>
    • <bdo id='6mPBs'></bdo><ul id='6mPBs'></ul>

      1. <i id='6mPBs'><tr id='6mPBs'><dt id='6mPBs'><q id='6mPBs'><span id='6mPBs'><b id='6mPBs'><form id='6mPBs'><ins id='6mPBs'></ins><ul id='6mPBs'></ul><sub id='6mPBs'></sub></form><legend id='6mPBs'></legend><bdo id='6mPBs'><pre id='6mPBs'><center id='6mPBs'></center></pre></bdo></b><th id='6mPBs'></th></span></q></dt></tr></i><div id='6mPBs'><tfoot id='6mPBs'></tfoot><dl id='6mPBs'><fieldset id='6mPBs'></fieldset></dl></div>

      2. <small id='6mPBs'></small><noframes id='6mPBs'>

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

        Rewrite file extension BUT deny direct access to file(重写文件扩展名但拒绝直接访问文件)
        <tfoot id='LePVa'></tfoot>

      3. <small id='LePVa'></small><noframes id='LePVa'>

              <bdo id='LePVa'></bdo><ul id='LePVa'></ul>

              <legend id='LePVa'><style id='LePVa'><dir id='LePVa'><q id='LePVa'></q></dir></style></legend>
            • <i id='LePVa'><tr id='LePVa'><dt id='LePVa'><q id='LePVa'><span id='LePVa'><b id='LePVa'><form id='LePVa'><ins id='LePVa'></ins><ul id='LePVa'></ul><sub id='LePVa'></sub></form><legend id='LePVa'></legend><bdo id='LePVa'><pre id='LePVa'><center id='LePVa'></center></pre></bdo></b><th id='LePVa'></th></span></q></dt></tr></i><div id='LePVa'><tfoot id='LePVa'></tfoot><dl id='LePVa'><fieldset id='LePVa'></fieldset></dl></div>
                  <tbody id='LePVa'></tbody>
                • 本文介绍了重写文件扩展名但拒绝直接访问文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种通过 .htaccess 隐藏文件扩展名并拒绝直接访问的方法.让我们考虑以下几点:

                  I am looking for a way to hide the file extension via .htaccess and deny direct access. Let's consider the following:

                  http://www.xyz.zyx/index.php 
                  

                  转换为

                  http://www.xyz.zyx/index OR http://www.xyz.zyx/
                  

                  到目前为止一切都很好.我接下来要做的是在用户尝试直接访问时阻止或重定向.例如,如果用户在 URL 栏中键入以下内容(扩展名),则阻止或重定向:

                  All good till now. What I want to do next is block or redirect when the user tries a direct access. Example, if the user types in the URL bar the following (extension), block or redirect:

                  http://www.xyz.zyx/index.php
                  

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

                  I checked the other answers from other questions, but non seemed to be exactly it.

                  预先感谢您帮助像我这样的新手.

                  推荐答案

                  虽然人们可能会质疑这样一个东西的用处,但它是可行的,所以这里是如何在 .htaccess 中使用 <代码>mod_rewrite:

                  Although one may question the usefulness of such a thing, it's feasible, so here's how to do it in a .htaccess using mod_rewrite:

                  RewriteEngine On
                  
                  # Sets your index script
                  RewriteRule ^$ index.php [L]
                  
                  # Condition prevents redirect loops (when script is not found)
                  RewriteCond %{ENV:REDIRECT_STATUS} !^$
                  RewriteCond %{REQUEST_FILENAME} !-f
                  
                  # Stop here if the file is not found after a redirect
                  RewriteRule ^(.*)$ notfound.php [L]
                  
                  # Condition prevents redirect loops (when script is found)
                  RewriteCond %{ENV:REDIRECT_STATUS} ^$
                  
                  # Forbid access directly to PHP files
                  RewriteRule ^.*?.php$ forbidden [F,L]
                  
                  # Make sure the filename does not actually exist (images, etc.)
                  RewriteCond %{REQUEST_FILENAME} !-f
                  
                  # Append the .php extension to the URI
                  RewriteRule ^(.*)$ $1.php [L] 
                  

                  这篇关于重写文件扩展名但拒绝直接访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='b4V9g'></tfoot>
                    <bdo id='b4V9g'></bdo><ul id='b4V9g'></ul>
                  • <i id='b4V9g'><tr id='b4V9g'><dt id='b4V9g'><q id='b4V9g'><span id='b4V9g'><b id='b4V9g'><form id='b4V9g'><ins id='b4V9g'></ins><ul id='b4V9g'></ul><sub id='b4V9g'></sub></form><legend id='b4V9g'></legend><bdo id='b4V9g'><pre id='b4V9g'><center id='b4V9g'></center></pre></bdo></b><th id='b4V9g'></th></span></q></dt></tr></i><div id='b4V9g'><tfoot id='b4V9g'></tfoot><dl id='b4V9g'><fieldset id='b4V9g'></fieldset></dl></div>

                        <tbody id='b4V9g'></tbody>
                        • <legend id='b4V9g'><style id='b4V9g'><dir id='b4V9g'><q id='b4V9g'></q></dir></style></legend>

                          <small id='b4V9g'></small><noframes id='b4V9g'>