首页 文章

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

提问于
浏览
0

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

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

经过上述更改后,我的索引页面在localhost上打开很好 . 但是索引页面中的所有链接都重定向到http://localhost/dashboard/ .

我没有改变.htaccess文件内容 . 这里是 :

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

怎么解决这个?

2 回答

  • 4

    如果你需要删除 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]
    
  • 2
    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]
    

    试试这个

相关问题