我需要重定向/index.php到主站点,没有索引,但只在主页上。
我在htaccess中使用此代码。
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]但问题是,在Admin面板中,需要index.php才能使页面正常工作。这条规则是每次出现在任何页面上都会删除index.php。
我试过像这样加一行
RewriteCond %{REQUEST_URI} !^/AdminPanel/index\.php.*$在RewriteRule之前但是它不会改变任何事情。
希望你能帮上忙。
发布于 2014-09-10 07:48:19
从正则表达式中删除.*:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/index\.php
RewriteRule ^index\.php$ / [R=301,L]https://stackoverflow.com/questions/25759948
复制相似问题