Php 所有链接重定向到localhost/dashboard/with codeigniter

Php 所有链接重定向到localhost/dashboard/with codeigniter,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我对codeigniter非常陌生。 我有一个codeigniter项目,我需要做一些更改。我已经将它粘贴到htdocs中,并将application/config/config.php的base_url更改为localhost的路径 并更改了application/config/database.php中的数据库连接 经过上述更改后,我的索引页在localhost上打开得很好。但是索引页中的所有链接都重定向到 我没有更改.htaccess文件内容。 这是: RewriteEngine On R

我对codeigniter非常陌生。 我有一个codeigniter项目,我需要做一些更改。我已经将它粘贴到htdocs中,并将application/config/config.php的base_url更改为localhost的路径

并更改了application/config/database.php中的数据库连接

经过上述更改后,我的索引页在localhost上打开得很好。但是索引页中的所有链接都重定向到

我没有更改.htaccess文件内容。 这是:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
如何解决这个问题

RewriteEngine on
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php/$1 [L]

如果需要删除
index.php

请尝试此操作,然后使用此

RewriteEngine on

RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

使用此
RewriteBase/
您需要删除
index.php
?使用此代码,现在它不会重定向到localhost/dashboard。它现在正在打开像、、这样的链接,但page说遇到了一个错误,无法加载请求的文件:frontend/brockhures.php。对于所有显示的url,您调用此文件
frontend/brockhures.php
add code请参见此链接中的示例,无法加载请求的文件:frontend/brockhures.php。但是我没有在application/config/routes.php文件中找到任何与此相关的路由。没有,我问过如何在视图
frontend/brockhures.php
中调用此文件?我只是发现在视图/文件夹中没有文件“brockhures.php”,因此出现了错误。谢谢你抽出时间。