将不存在的一切重定向到index.php,您也可以使用FallBackResource指令FallbackResource /index.php它的工作原理与ErrorDocument,当您请求服务器上不存在的路径或文件时,指令会悄悄地将请求禁止到index.php .如果你想重定向一切(including existant files or folders)到index.php,您可以使用以下内容:RewriteEngine onRewriteRule ^((?!index\.php).+)$ /index.php [L]注意模式^((?!index\.php).+)$与任何uri匹配,除非index.php为了防止无限循环错误,我们排除了目标路径。