I have this problem in redirect to admin controller. My first page is login page. I get user and password from user and when I click on submit it goes to : [ http://localhost:2020/taxiapp/admin/dashboard] and i get this error:"Object not found!"
in admin-login I use this code to post information to admin controller:
if($user2)
{
redirect("http://$_SERVER[HTTP_HOST]/taxiapp/admin/dashboard");
}
From your question I think you are not able to redirect to a specific page. To redirect in PHP. Try using the following code
header("Location: http://$_SERVER[HTTP_HOST]/taxiapp/admin/dashboard");
Let me know if this works for you.
add like this,
redirect("admin/dashboard");
also, make sure your base_url
like following
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].':'. $_SERVER['SERVER_PORT'].'/taxiapp/';
I faced exactly this same problem but it was on a live server with Ubuntu 16.x This problem is with mod_rewrite and your .htaccess file. So make sure mod_rewrite is properly installed and set up... i did sudo a2enmod rewrite for that and restarted my server.
Now the important part.
First i changed my Virtualhost config with sudo nano /etc/apache2/sites-available/000-default.conf
by adding this at the very top after the VirtualHost *:80
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Then created my application .htacess with nano /var/www/html/.htaccess in the root of my application folder with
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
This should give you an idea on how to solve it in Xampp
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.