linux – .htaccess redirect index.php到/
发布时间:2020-12-13 19:33:38 所属栏目:Linux 来源:网络整理
导读:我想隐藏index.php页面,只显示域名. 这可能与.htaccess一起使用吗? RewriteRule ^index.php/?$/ [L,R=301,NC] 还尝试过: RewriteEngine OnRewriteBase /RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/RewriteRule ^index.php$http://example.c
我想隐藏index.php页面,只显示域名.
这可能与.htaccess一起使用吗? RewriteRule ^index.php/?$/ [L,R=301,NC] 还尝试过: RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/ RewriteRule ^index.php$http://example.com/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] index.php仍然显示 解决方法
试试吧,它对我有用!确保在httpd.conf中设置了AllowOverride All
RewriteEngine On RewriteCond %{REQUEST_URI} index.php RewriteRule ^(.*)index.php$/$1/ [R=301,L] 您的规则中存在正则表达式问题,我修改了您的规则并且它适用于我: RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} index.php RewriteRule ^index.php$http://example.com/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |