.htaccess - 将index.php重定向到root

标签 .htaccess url

我以前做过这个,就像一行代码。现在,当我查找它时,只有 5-10 行,用于将 index.php 重定向到 .htaccess 中的根目录 (/)。

最好的方法是什么?

最佳答案

这段代码对我有用

RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 

关于.htaccess - 将index.php重定向到root,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16060876/

相关文章:

java - 在网络的 ImageView 中显示 .jpg

php - htaccess 使用完整的 url 重定向

java - 有没有简单的小程序 url 生成器?

php - 我可以将 index.php 放在子目录中,但不在 url 中显示子目录吗?

php - 从 xampp 的 codeigniter 中删除 index.php

javascript - 突出显示 URL 中的搜索值

android - facebook 分享图像 Url 以及 android 中的链接

php - 如何在浏览器中运行http url后通过echo显示结果

.htaccess mod_rewrite 域之间的重定向

php - 如何不在来自 AJAX POST 调用的文件上包含 htaccess 重定向