Apache 如何自动隐藏 index.php

已经设置了 .htaccess 文件

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

访问 index.php/xxx 的时候还是照常访问,不会变成 /xxx 这样的地址,如果我想要 index.php/xxx 会自动跳到 /xxx 请问如何处理?

阅读 4.2k
1 个回答
新手上路,请多包涵

RewriteBase /index.php所在的DocumentRoot,把.htaccess放在这里

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [QSA,PT,L]

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进