Reputation: 455
i have installed codigniter on xamp but I have searched on google and have tried many things but stil when I type in address it shows me object not found but when I add index.php it is working fine how do I remove index.php and make it work properly
Here is my .htaccess
RewriteEngine On
RewriteBase /mywebsite
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [PT,L]
This is my config.php
$config['base_url'] = '/mywebsite';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
This is my routes .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";
Upvotes: 0
Views: 115
Reputation: 1099
Your base url should be:
http://localhost/mywebsite/
And you shouldn't need this in your htaccess:
RewriteBase /mywebsite
Upvotes: 2
Reputation: 16436
1) Remove
RewriteBase /mywebsite
from .htaccess
2) Make sure mod_rewrite
is enabled
3) Make sure your $config['base_url']
is correct
4) Your .htaccess
file must be in root directory of your project and not of application directory
.htaccess file
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Upvotes: 1
Reputation: 850
ensure .htaccess file is inside of 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';
Then navigate to http://localhost/mywebsite
Upvotes: 1