【发布时间】:2017-05-21 15:33:34
【问题描述】:
我有一些问题。在开发中,我使用的是 php 7,我的网站运行良好。但是在生产中使用 php 5.4 并且我在删除 index.php 时遇到了问题。我的网站托管在子文件夹中,就像myhost/mywebsitefolder。
问题出在使用 url 函数时。例如,当我访问“仪表板”页面时,它将重定向到“登录”页面,并且 URL 类似于 myhost/mywebsitefolder/login,它返回 404 页面未找到。当我在登录前添加 index.php (myhost/mywebsitefolder/index.php/login) 时效果很好,但我必须通过添加 index.php 来替换我的所有 url。有没有什么解决办法。我的.htaccess就是这样的。
RewriteEngine on
RewriteBase /mywebsitefolder/
RewriteCond $1 !^(index.php|resources|gallery|json|slider|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
【问题讨论】:
-
尝试在
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]行中添加问号。
标签: php .htaccess codeigniter codeigniter-3