<legend id='3o6Hq'><style id='3o6Hq'><dir id='3o6Hq'><q id='3o6Hq'></q></dir></style></legend>
    <i id='3o6Hq'><tr id='3o6Hq'><dt id='3o6Hq'><q id='3o6Hq'><span id='3o6Hq'><b id='3o6Hq'><form id='3o6Hq'><ins id='3o6Hq'></ins><ul id='3o6Hq'></ul><sub id='3o6Hq'></sub></form><legend id='3o6Hq'></legend><bdo id='3o6Hq'><pre id='3o6Hq'><center id='3o6Hq'></center></pre></bdo></b><th id='3o6Hq'></th></span></q></dt></tr></i><div id='3o6Hq'><tfoot id='3o6Hq'></tfoot><dl id='3o6Hq'><fieldset id='3o6Hq'></fieldset></dl></div>

  • <small id='3o6Hq'></small><noframes id='3o6Hq'>

        <tfoot id='3o6Hq'></tfoot>
          <bdo id='3o6Hq'></bdo><ul id='3o6Hq'></ul>
      1. 当目录存在时用htaccess重写url

        Rewriting url with htaccess when a directory exists(当目录存在时用htaccess重写url)
      2. <tfoot id='ZzCEW'></tfoot>
            <bdo id='ZzCEW'></bdo><ul id='ZzCEW'></ul>
              <tbody id='ZzCEW'></tbody>

            <legend id='ZzCEW'><style id='ZzCEW'><dir id='ZzCEW'><q id='ZzCEW'></q></dir></style></legend>
            <i id='ZzCEW'><tr id='ZzCEW'><dt id='ZzCEW'><q id='ZzCEW'><span id='ZzCEW'><b id='ZzCEW'><form id='ZzCEW'><ins id='ZzCEW'></ins><ul id='ZzCEW'></ul><sub id='ZzCEW'></sub></form><legend id='ZzCEW'></legend><bdo id='ZzCEW'><pre id='ZzCEW'><center id='ZzCEW'></center></pre></bdo></b><th id='ZzCEW'></th></span></q></dt></tr></i><div id='ZzCEW'><tfoot id='ZzCEW'></tfoot><dl id='ZzCEW'><fieldset id='ZzCEW'></fieldset></dl></div>

          • <small id='ZzCEW'></small><noframes id='ZzCEW'>

                  本文介绍了当目录存在时用htaccess重写url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试将动态页面重定向到目录,例如:

                  I'm trying to redirect a dynamic page to a dir, example:

                  url.com/index.php?page=download
                  to
                  url.com/download
                  

                  规则很简单:

                  RewriteRule ^download$ /index.php?page=download
                  

                  完整的.HTACCESS

                  FULL .HTACCESS

                  RewriteEngine On
                  RewriteBase /
                  
                  RewriteCond %{HTTP_HOST} !^www.url.com$
                  RewriteRule ^(.*) http://url.com/$1 [R=301,L]
                  
                  Redirect 301 /index.php?page=download http://url.com/download
                  RewriteCond %{ENV:REDIRECT_STATUS} 200
                  RewriteRule .* - [L]
                  RewriteRule ^download$ /index.php?page=download
                  

                  问题是我已经有一个名为download"的目录,它返回一个403 Forbidden Error".我注意到将目录重命名为与规则使用的名称(下载)不同的任何名称都可以.

                  The problem is that I already have a directory named "download" and it's returning me a "403 Forbidden Error". I have noticed that renaming the directory to anything different than the name (download) the rule is using will work.

                  所以,我的问题是:如何按照我需要的方式重写我的 url 并保留目录?

                  So, my question is: how can I have my url rewritten the way I need and keep the directory?

                  -- 编辑 --

                  默认情况下,我的服务器使用403 Forbbiden 错误"保护每个目录.我相信这是它不起作用的原因,但我不确定.真的有冲突吗?发生了什么?

                  My server, by default, protects every directory with a "403 Forbbiden Error". I believe this is the reason why it's not working, but I'm not sure. Is it a conflict indeed? What is happening?

                  推荐答案

                  /download/?page=download
                  

                  发生这种情况的原因是因为某处 mod_dir 将所有对缺少尾部斜杠的目录的请求重定向到包含尾部斜杠.这会干扰您的重写规则.由于您的服务器已自动设置为拒绝列出目录,因此继续关闭目录斜杠可能是安全的:

                  The reason why this is happening is because somewhere mod_dir redirects all requests for directories that are missing the trailing slash to include the trailing slash. This is interferring with your rewrite rule. Since your server is automatically setup to deny listing of directories, it's probably safe to go ahead and turn directory slashes off:

                  DirectorySlash Off
                  

                  答案:https://stackoverflow.com/users/851273/jon-lin

                  这篇关于当目录存在时用htaccess重写url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

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

                  1. <tfoot id='lGG0z'></tfoot>

                      <i id='lGG0z'><tr id='lGG0z'><dt id='lGG0z'><q id='lGG0z'><span id='lGG0z'><b id='lGG0z'><form id='lGG0z'><ins id='lGG0z'></ins><ul id='lGG0z'></ul><sub id='lGG0z'></sub></form><legend id='lGG0z'></legend><bdo id='lGG0z'><pre id='lGG0z'><center id='lGG0z'></center></pre></bdo></b><th id='lGG0z'></th></span></q></dt></tr></i><div id='lGG0z'><tfoot id='lGG0z'></tfoot><dl id='lGG0z'><fieldset id='lGG0z'></fieldset></dl></div>
                        • <legend id='lGG0z'><style id='lGG0z'><dir id='lGG0z'><q id='lGG0z'></q></dir></style></legend>
                            <tbody id='lGG0z'></tbody>
                            <bdo id='lGG0z'></bdo><ul id='lGG0z'></ul>