【发布时间】:2019-01-10 21:33:40
【问题描述】:
ci url 是否可能不适用于 index.php。我不想在 url 中添加 index.php。如果有人在 url 中添加 index.php 它应该不起作用。我尝试了很多方法。请给我建议。 我试过了,还是不行
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
例如
如果我使用下面的 url 这应该可以........
`example.com/abc`
如果我使用下面的网址不应该工作
`example.com/index.php/abc`
【问题讨论】:
-
请查看以下链接。
点击[stackoverflow.com/questions/19183311/…] -
如果您想要简单的解决方案,只需将
index.php文件重命名为其他名称,并将RewriteRule修改为指向该文件,这比编写复杂的不必要的重写条件要好。
标签: php codeigniter .htaccess