Apache .htaccess在检查firefox中的index.php时生成一个pre标记

Apache .htaccess在检查firefox中的index.php时生成一个pre标记,apache,.htaccess,pre,php-7.3,Apache,.htaccess,Pre,Php 7.3,构建一个最低限度的MVC,我需要有一个(.htaccess)用于路由目的。我正在使用apache和虚拟端口 php是可见的,但是一个pre标记(不是html源代码的一部分)和它的空白使页面向下移动,就好像顶部有一个250px的边距 出于某种原因,.htaccess的使用将html代码包装在一个pre标记中,其结果是头部内容移动到主体区域,并在每行meta/title/link标记之间添加空白 观察结果: <VirtualHost *:100> DocumentRoot

构建一个最低限度的MVC,我需要有一个(.htaccess)用于路由目的。我正在使用apache和虚拟端口

php是可见的,但是一个pre标记(不是html源代码的一部分)和它的空白使页面向下移动,就好像顶部有一个250px的边距

出于某种原因,.htaccess的使用将html代码包装在一个pre标记中,其结果是头部内容移动到主体区域,并在每行meta/title/link标记之间添加空白

观察结果:

<VirtualHost *:100>
        DocumentRoot /var/www/mvc
</VirtualHost>

<Directory /var/www/mvc/versions/>
        Options Indexes FollowSymLinks
        AllowOverride All
</Directory>
删除(.htaccess)将使index.php的结果恢复正常,并且pre标记在浏览器中不可见(查看页面源代码),页面将按其应有的方式从浏览器顶部开始

My index.php

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="application/content/css/main.css">
</head>
<body>

  <div class="wrapper">
    <div class="top_banner">tb</div>
    <div class="content">c</div>
    <div class="navigation">n</div>
    <div class="bottom_bar">bb</div>
  </div>

</body>
</html>
<pre>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="application/content/css/main.css">
</head>
<body>

  <div class="wrapper">
    <div class="top_banner">tb</div>
    <div class="content">c</div>
    <div class="navigation">n</div>
    <div class="bottom_bar">bb</div>
  </div>

</body>
</html>
我的apache文件(000默认配置):

<VirtualHost *:100>
        DocumentRoot /var/www/mvc
</VirtualHost>

<Directory /var/www/mvc/versions/>
        Options Indexes FollowSymLinks
        AllowOverride All
</Directory>

DocumentRoot/var/www/mvc
选项索引跟随符号链接
允许超越所有
浏览器中的结果html(查看页面来源):

<VirtualHost *:100>
        DocumentRoot /var/www/mvc
</VirtualHost>

<Directory /var/www/mvc/versions/>
        Options Indexes FollowSymLinks
        AllowOverride All
</Directory>

文件
结核病
C
N
bb
firefox inspector HTML代码

RewriteEngine On
RewriteRule \.(css|js|png|jpg|gif)$ - [L]
RewriteRule ^([^/]+)/? index.php?url=$1 [L,QSA]
DirectoryIndex index.php

# Attempts to solve the problem with pre-tag.
#AddDefaultCharset UTF-8
#AddType text/html;charset=utf-8 html
#AddType text/plain;charset=iso-8859-1 txt
#AddType text/plain;charset=utf-8 text

文件
结核病
C
N
bb

在重写中,规则替换路径是相对的,所以根据apache文档,apache尝试猜测:

mod_rewrite尝试猜测您是否指定了文件系统 通过检查路径的第一段是否 存在于文件系统的根目录下

你应该读一读,也许你有一个文件在某处添加了pre标签