简体   繁体   English

从PHP站点删除index.php

[英]removing index.php from site in php

Whenever I try logging into my site with a wrong user details, I get redirected from www.example.com/ to www.example.com/index.php . 每当我尝试使用错误的用户详细信息登录我的网站时,都会从www.example.com/重定向到www.example.com/index.php

I would like to remove index.php from my link. 我想从我的链接中删除index.php

Here is the content of my htaccess file, which does not work for me. 这是我的htaccess文件的内容,该文件对我不起作用。

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.php\ HTTP/
RewriteRule ^(.*)\.php$ /$1 [R=301,L]

RewriteRule ^login index.php [NC,L]

Check if this can work for you: 检查是否可以为您工作:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Check mod_rewrite module is enabled if not you first enable it. 如果不先启用,请检查是否启用了mod_rewrite模块。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Reference 参考

htaccess documrntation htaccess文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM