what i'm trying to do is to remove the index.php file in my urls in CodeIgniter following this documentation:
http://www.codeigniter.com/userguide3/general/urls.html#removing-the-index-php-file
I wrote .htaccess file with thid code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
But when i try to access the url: http://127.0.0.1/my-site/admin , this is redirected to http://127.0.0.1/dashboard
This is my base_url config:
$config['base_url'] = ' http://127.0.0.1/my-site ';
And this is routes.php file:
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['admin']='admin/index';
$route['admin/login']='admin/login';
Any help would be appreciated!
try this one
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
if your using wamp Server left click tray
icon->Apache->Apache modules->and find and click on rewrite_module
Firstly, ensure that your .htaccess file is working (loaded by Apache/PHP)
To test this, open your .htaccess file and type some junk text (eg. testing..) and save the file.
Now load your application's home page. (eg. http://localhost/mywebapp/ )
If you get an 'Internal Server Error' then it means your .htaccess file is working. Else if the default page is loading, then it means your .htaccess file is not loading.
If your .htaccess file is not working then, it is due to the Apache config issue.
Open Apache config file (typically C:\\Apache\\conf\\httpd.conf)
Search for word 'AllowOverride'.
Change values of all the instances from
AllowOverride None
to
AllowOverride All
Save Apache config file.
Restart Apache Service/Server.
This should solve your redirection issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.