1. <tfoot id='JL5Yw'></tfoot><legend id='JL5Yw'><style id='JL5Yw'><dir id='JL5Yw'><q id='JL5Yw'></q></dir></style></legend>

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

      • <bdo id='JL5Yw'></bdo><ul id='JL5Yw'></ul>

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

        XAMPP .htaccess mod_rewrite 不工作

        时间:2024-04-12
          <i id='ayAt6'><tr id='ayAt6'><dt id='ayAt6'><q id='ayAt6'><span id='ayAt6'><b id='ayAt6'><form id='ayAt6'><ins id='ayAt6'></ins><ul id='ayAt6'></ul><sub id='ayAt6'></sub></form><legend id='ayAt6'></legend><bdo id='ayAt6'><pre id='ayAt6'><center id='ayAt6'></center></pre></bdo></b><th id='ayAt6'></th></span></q></dt></tr></i><div id='ayAt6'><tfoot id='ayAt6'></tfoot><dl id='ayAt6'><fieldset id='ayAt6'></fieldset></dl></div>

          1. <tfoot id='ayAt6'></tfoot>
                  <tbody id='ayAt6'></tbody>
                • <bdo id='ayAt6'></bdo><ul id='ayAt6'></ul>
                  <legend id='ayAt6'><style id='ayAt6'><dir id='ayAt6'><q id='ayAt6'></q></dir></style></legend>
                • <small id='ayAt6'></small><noframes id='ayAt6'>

                  本文介绍了XAMPP .htaccess mod_rewrite 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在为 Windows 5.6.11 运行 XAMPP.我有以下 PHP 文件:

                  I am running XAMPP for Windows 5.6.11. I have the following PHP file:

                  C:xampphtdocswww.johndoe.comindex.php
                  

                  我正在访问的

                  http://localhost/www.johndoe.com/
                  

                  事实上,我需要访问以下页面:

                  As a matter of fact I need to access the following page:

                  http://localhost/www.johndoe.com/?value=about
                  

                  作为以下两种之一:

                  http://localhost/www.johndoe.com/about/
                  http://localhost/www.johndoe.com/about
                  

                  所以我的 .htaccess 文件中有以下内容:

                  so I have the following in my .htaccess file:

                  RewriteEngine on
                  RewriteRule ^www.johndoe.com/about/?$ www.johndoe.com/?value=about
                  

                  但是,这不起作用,因为访问以前的网站会给我一个 401(未找到).

                  However, this is not working, as accessing the former sites gives me a 401 (not found).

                  这是我在 C:xamppapacheconfhttpd.conf 中的内容:

                  Here is what I have in C:xamppapacheconfhttpd.conf:

                  <Directory />
                      AllowOverride none
                      Require all denied
                  </Directory>
                  
                  DocumentRoot "C:/xampp/htdocs"
                  <Directory "C:/xampp/htdocs">
                      Options Indexes FollowSymLinks Includes ExecCGI
                      AllowOverride All
                      Require all granted
                  </Directory>
                  

                  我必须怎么做才能解析我的 .htaccess 文件并执行我想要的替换?

                  What must I do to get my .htaccess file to be parsed and carry out the substitution I'm after?

                  我尝试将以下内容放在 C:xamppapacheconfhttpd.conf:

                  I have tried placing the following in C:xamppapacheconfhttpd.conf:

                  <Directory />
                      AllowOverride all
                      Require all allowed
                  </Directory>
                  

                  但没有运气.我什至尝试将我的 .htaccess 文件更改为以下内容:

                  but have had no luck with it. I have even tried changing my .htaccess file to the following:

                  RewriteEngine on
                  
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  
                  RewriteBase /www.johndoe.com/
                  RewriteRule ^about/?$ ?value=about
                  

                  但我仍然收到 404 not found 错误消息.

                  but I'm still getting the 404 not found error message.

                  推荐答案

                  事实证明,使用默认的 XAMPP 配置,不需要 C:xamppapacheconfhttpd.conf,因此无需重新启动 Apache,因为我们只是对 C:xampphtdocswww.johndoe.com.htaccess 进行更改.作为 这个RewriteBase 上的帖子 解释说,我们不需要 RewriteBase 因为我们不会在目标链接中为 .htaccess 规则使用绝对路径.由于这些目标规则中的相对链接将相对于我们提供服务的目录,因此我们需要从规则中删除 www.johndoe.com 目录,如下所示:

                  As it turns out, with the default XAMPP configuration there is no need to C:xamppapacheconfhttpd.conf, hence no need to restart Apache as we are just making changes to C:xampphtdocswww.johndoe.com.htaccess. As this post on RewriteBase explains, we do not need RewriteBase since we will not use absolute paths in the destination links for .htaccess rules. Since relative links in these destination rules will be relative to the directory we are serving out of, we need delete the www.johndoe.com directory from the rule, as follows:

                  • .htaccess 放在 ``C:xampphtdocswww.johndoe.com` 中.
                  • 将以下重写规则放入其中:

                  • Place the .htaccess in ``C:xampphtdocswww.johndoe.com`.
                  • Place the following rewiterule in it:

                  RewriteEngine on
                  RewriteRule ^about/?$ index.php?value=about
                  

                  这篇关于XAMPP .htaccess mod_rewrite 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:致命错误:超过 400 秒的最大执行时间 下一篇:XAMPP 服务器不加载 CSS 文件

                  相关文章

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

                • <tfoot id='BHUTV'></tfoot>

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

                      <legend id='BHUTV'><style id='BHUTV'><dir id='BHUTV'><q id='BHUTV'></q></dir></style></legend>