我已经在xamp上安装了codigniter,但是我已经在google上搜索并尝试了很多东西但是当我输入地址时它显示我找不到对象但是当我添加index.php时它工作正常如何删除索引。 php并使其正常工作
这是我的.htaccess
RewriteEngine On
RewriteBase /mywebsite
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [PT,L]
这是我的config.php
$config['base_url'] = '/mywebsite';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
这是我的路线.php
$route['default_controller'] = "home";
$route['404_override'] = 'c404';
$route['post/(:any)/(:any)'] = "blog/viewPost/$2";
$route['category/(:any)/(:any)'] = "blog/viewPostcategory/$2/$1";
$route['search'] = "blog/search";
$route['symbol/(:any)'] = "companies/view/$1";
答案 0 :(得分:1)
1)删除
来自.htaccess的RewriteBase /mywebsite
2)确保mod_rewrite
已启用
3)确保$config['base_url']
正确无误
4)您的.htaccess
文件必须位于项目的根目录中,而不是应用程序目录
.htaccess 文件
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
答案 1 :(得分:1)
确保.htaccess文件位于mywebsite /
中RewriteEngine On
RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
的config.php
$config['base_url'] = 'http://localhost/mywebsite';
然后导航至http://localhost/mywebsite