删除部署在Windows 10上localhost中的codeigniter中的index.php

时间:2016-02-24 21:02:55

标签: php apache .htaccess codeigniter

这是我的.htaccess文件。我的xampp安装位于我的E驱动器上。我将.htaccess文件放在我htdocs的{​​{1}}中。

E:\xampp\htdocs\.htaccess

我还将Codeigniter中的RewriteEngine on RewriteBase / # Hide the application and system directories by redirecting the request to index.php RewriteRule ^(application|system|\.svn) index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [QSA,L] # Remove www from any URLs that have them: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\. RewriteRule ^(.*)$ http://mobiloka.com/$1 [R=301,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END 更改为:

config.php

我试过了两个:

$config['index_page'] = '';

每当我尝试导航到我网站上的另一个页面时,它就会进入仪表板。我应该怎么做才能在没有$config['uri_protocol'] = 'AUTO'; $config['uri_protocol'] = 'REQUEST_URI'; 的情况下访问localhost中的网站?

1 个答案:

答案 0 :(得分:0)

看起来您正在使用codeIgniter 2版本

  

如果您的uri_protocol Auto使用CodeIgniter 3已被删除。

尝试将此htaccess用于xampp。并将其放在项目的主目录中。应用程序文件夹的一侧。

htdocs / 
  your_codeigniter_project_folder / 
  your_codeigniter_project_folder /  application_folder /
  your_codeigniter_project_folder / system_folder /
  your_codeigniter_project_folder / .htaccess
  your_codeigniter_project_folder / index.php

的.htaccess

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

在config.php上

$config['base_url'] = 'http://localhost/your_project_name/';
$config['index_page'] = '';