【发布时间】:2014-09-10 07:46:18
【问题描述】:
我需要将 /index.php 重定向到没有索引但只在主页上的主站点。
我在 htaccess 中使用此代码
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
但问题是在管理面板中有路由需要 index.php 才能使页面正常工作。这条规则是每次出现在任何页面上时都会删除 index.php。
我尝试添加这样的行
RewriteCond %{REQUEST_URI} !^/AdminPanel/index\.php.*$
在 RewriteRule 之前,但它不会改变任何东西。
希望你能帮忙。
【问题讨论】:
-
我在很多方面结合了最后提到的那一行,但我无法让它正常工作。
标签: .htaccess mod-rewrite redirect http-status-code-301