CodeIgniter Localhost重定向到xampp主屏幕

Nom*_*Ali 5 php apache .htaccess codeigniter url-rewriting

当我在浏览器中运行CI项目时,使用localhost/hr,它将我重定向到localhost/dashboard /.

搜索了不同的解决方案,但没有得到它的工作.这是我在" htdocs/hr "文件夹中的.htaccess文件

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

注意:htdocs文件夹中没有.htaccess文件.

当我删除/重命名index.php文件并访问htdocs时,它给了我错误.

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. 
Run Code Online (Sandbox Code Playgroud)

我做错了什么,如何让它运作?

我的htdocs/hr文件夹的屏幕截图是下面的

在此输入图像描述

sha*_*ver 7

我知道我迟到了.但是没有其他答案说明你实际需要做什么来解决这个问题.

方案:

您需要在您的文件夹中的.htaccess文件中设置重写基础(ci).

所以你现在有

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
Run Code Online (Sandbox Code Playgroud)

你应该把它改成

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ci/
Run Code Online (Sandbox Code Playgroud)

就是这样.它现在可以工作了.