我想隐藏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]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。